Initial quantum compute and cleaning up win server.
This commit is contained in:
parent
af50eea208
commit
5362b694e0
45 changed files with 884 additions and 429 deletions
8
plugins/quantum_computing/test/CMakeLists.txt
Normal file
8
plugins/quantum_computing/test/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
list(APPEND UNIT_TEST_FILES
|
||||
TestBlochSphereNode.cpp
|
||||
)
|
||||
|
||||
add_executable(quantum_computing_unit_tests ${CMAKE_SOURCE_DIR}/test/test_runner.cpp ${UNIT_TEST_FILES})
|
||||
target_link_libraries(quantum_computing_unit_tests PUBLIC test_utils quantum_computing)
|
||||
set_property(TARGET quantum_computing_unit_tests PROPERTY FOLDER plugins)
|
35
plugins/quantum_computing/test/TestBlochSphereNode.cpp
Normal file
35
plugins/quantum_computing/test/TestBlochSphereNode.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include "TestFramework.h"
|
||||
#include "TestUtils.h"
|
||||
|
||||
#include "BlochSphereNode.h"
|
||||
#include "BlochSphere.h"
|
||||
#include "Scene.h"
|
||||
|
||||
#include "SvgConverter.h"
|
||||
#include "SvgWriter.h"
|
||||
|
||||
#include "File.h"
|
||||
|
||||
TEST_CASE(TestBlochSphereNode, "quantum_computing")
|
||||
{
|
||||
auto node = std::make_unique<BlochSphereNode>();
|
||||
|
||||
Qubit state({ 1.0, 0.0 }, { 0.0, 0.0 });
|
||||
|
||||
auto bloch_sphere = std::make_unique<BlochSphere>(state);
|
||||
|
||||
node->setContent(bloch_sphere.get());
|
||||
|
||||
auto scene = std::make_unique<Scene>();
|
||||
scene->addNode(node.get());
|
||||
scene->update();
|
||||
|
||||
SvgConverter converter;
|
||||
auto svg_document = converter.convert(scene.get());
|
||||
|
||||
SvgWriter writer;
|
||||
auto svg_content = writer.toString(svg_document.get());
|
||||
|
||||
File svg_file(TestUtils::getTestOutputDir(__FILE__) / "bloch_sphere.svg");
|
||||
svg_file.writeText(svg_content);
|
||||
}
|
0
plugins/quantum_computing/test/TestBlochSphereNode.h
Normal file
0
plugins/quantum_computing/test/TestBlochSphereNode.h
Normal file
Loading…
Add table
Add a link
Reference in a new issue