2023-01-09 17:31:13 +00:00
|
|
|
#include "TestFramework.h"
|
|
|
|
#include "TestUtils.h"
|
2023-01-12 17:45:06 +00:00
|
|
|
#include "TestRenderUtils.h"
|
2023-01-09 17:31:13 +00:00
|
|
|
|
|
|
|
#include "BlochSphereNode.h"
|
2023-01-16 12:36:02 +00:00
|
|
|
#include "CircleNode.h"
|
|
|
|
#include "LineNode.h"
|
2023-01-09 17:31:13 +00:00
|
|
|
#include "BlochSphere.h"
|
|
|
|
|
|
|
|
TEST_CASE(TestBlochSphereNode, "quantum_computing")
|
|
|
|
{
|
2023-01-16 12:36:02 +00:00
|
|
|
TestRenderer renderer(100, 100);
|
2023-01-12 17:45:06 +00:00
|
|
|
|
2023-01-30 14:53:49 +00:00
|
|
|
auto node = std::make_unique<BlochSphereNode>(Point2(0.5, 0.5));
|
2023-01-09 17:31:13 +00:00
|
|
|
|
2023-01-16 12:36:02 +00:00
|
|
|
Qubit state({ 1.0, 0.0 }, { 0.0, 0.0 });
|
2023-01-09 17:31:13 +00:00
|
|
|
|
2023-01-16 12:36:02 +00:00
|
|
|
auto bloch_sphere = std::make_unique<BlochSphere>(state);
|
2023-01-09 17:31:13 +00:00
|
|
|
|
2023-01-16 12:36:02 +00:00
|
|
|
node->setSize(100);
|
|
|
|
node->setContent(bloch_sphere.get());
|
|
|
|
|
|
|
|
renderer.getScene()->addNode(node.get());
|
|
|
|
renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "bloch_sphere.svg");
|
|
|
|
}
|