Loading python/tests/CMakeLists.txt +7 −0 Original line number Diff line number Diff line Loading @@ -74,3 +74,10 @@ add_test (NAME qcor_python_jit_kernel_signature set_tests_properties(qcor_python_jit_kernel_signature PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}:$ENV{PYTHONPATH}") add_test (NAME qcor_python_compute_action COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_compute_action.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) set_tests_properties(qcor_python_compute_action PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}:$ENV{PYTHONPATH}") No newline at end of file python/tests/test_compute_action.py 0 → 100644 +26 −0 Original line number Diff line number Diff line import faulthandler faulthandler.enable() import unittest from qcor import * class TestKernelJIT(unittest.TestCase): def test_compute_action(self): @qjit def test_compute_action1(q : qreg, x : float): with compute: X.ctrl(q[0], q[1]) for i in range(3): H(q[i+1]) with action: Rz(q[3], x) q = qalloc(5) comp0 = test_compute_action1.extract_composite(q, 1.2345) print(comp0) # First and last instructions are CNOT's self.assertEqual(comp0.getInstruction(0).name(), "CNOT") self.assertEqual(comp0.getInstruction(comp0.nInstructions() - 1).name(), "CNOT") if __name__ == '__main__': unittest.main() No newline at end of file Loading
python/tests/CMakeLists.txt +7 −0 Original line number Diff line number Diff line Loading @@ -74,3 +74,10 @@ add_test (NAME qcor_python_jit_kernel_signature set_tests_properties(qcor_python_jit_kernel_signature PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}:$ENV{PYTHONPATH}") add_test (NAME qcor_python_compute_action COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_compute_action.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) set_tests_properties(qcor_python_compute_action PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}:$ENV{PYTHONPATH}") No newline at end of file
python/tests/test_compute_action.py 0 → 100644 +26 −0 Original line number Diff line number Diff line import faulthandler faulthandler.enable() import unittest from qcor import * class TestKernelJIT(unittest.TestCase): def test_compute_action(self): @qjit def test_compute_action1(q : qreg, x : float): with compute: X.ctrl(q[0], q[1]) for i in range(3): H(q[i+1]) with action: Rz(q[3], x) q = qalloc(5) comp0 = test_compute_action1.extract_composite(q, 1.2345) print(comp0) # First and last instructions are CNOT's self.assertEqual(comp0.getInstruction(0).name(), "CNOT") self.assertEqual(comp0.getInstruction(comp0.nInstructions() - 1).name(), "CNOT") if __name__ == '__main__': unittest.main() No newline at end of file