Commit fbe1ccf3 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Added test for exp_i_theta



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent 3854b4a4
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -107,5 +107,18 @@ class TestSimpleKernelJIT(unittest.TestCase):
        self.assertTrue('00' in counts)
        self.assertTrue('11' in counts)
    
    def test_exp_i_theta(self):
        @qjit
        def kernelExpVar(q : qreg, theta: float):
            exponent_op = X(0) * Y(1) - Y(0) * X(1)
            exp_i_theta(q, theta, exponent_op)
        
        # Allocate 2 qubits
        q = qalloc(2)
        theta = 1.234
        # Validate exp_i_theta expansion
        comp = kernelExpVar.extract_composite(q, theta)
        self.assertEqual(comp.nInstructions(), 14)
       
if __name__ == '__main__':
  unittest.main()
 No newline at end of file