stuff-from-scratch/plugins/quantum_computing/test/TestBlochSphereNode.cpp
2023-01-30 14:53:49 +00:00

25 lines
650 B
C++

#include "TestFramework.h"
#include "TestUtils.h"
#include "TestRenderUtils.h"
#include "BlochSphereNode.h"
#include "CircleNode.h"
#include "LineNode.h"
#include "BlochSphere.h"
TEST_CASE(TestBlochSphereNode, "quantum_computing")
{
TestRenderer renderer(100, 100);
auto node = std::make_unique<BlochSphereNode>(Point2(0.5, 0.5));
Qubit state({ 1.0, 0.0 }, { 0.0, 0.0 });
auto bloch_sphere = std::make_unique<BlochSphere>(state);
node->setSize(100);
node->setContent(bloch_sphere.get());
renderer.getScene()->addNode(node.get());
renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "bloch_sphere.svg");
}