stuff-from-scratch/plugins/quantum_computing/test/TestQuantumSimulator.cpp

27 lines
682 B
C++
Raw Permalink Normal View History

2023-01-26 15:16:46 +00:00
#include "TestFramework.h"
#include "TestUtils.h"
#include "TestRenderUtils.h"
#include "QuantumCircuitReader.h"
#include "QuantumCircuitNode.h"
#include "QuantumCircuit.h"
#include "QuantumState.h"
#include "QuantumSimulator.h"
#include "File.h"
TEST_CASE(TestQuantumSimulator, "quantum_computing")
{
QuantumCircuitReader reader;
auto circuit = reader.read(TestUtils::getTestDataDir() / "quantum_circuit.dat");
QuantumSimulator simulator;
simulator.setCircuit(circuit.get());
simulator.run();
auto input_state = simulator.getInputState();
File file(TestUtils::getTestOutputDir(__FILE__) / "out.dat");
file.writeText(input_state.toString());
}