added test

This commit is contained in:
Didictateur 2023-10-26 16:09:46 +02:00
parent a1d73db471
commit d73c088df7

12
Gate_test.py Normal file
View file

@ -0,0 +1,12 @@
from QElephant.QuBit import *
## for IQuBit
mq = MuBit(2)
q = mq[1]
X(q)
assert mq._MuBit__state == [0, 1, 0, 0]
H(q)
assert mq._MuBit__state == [1/math.sqrt(2), -1/math.sqrt(2), 0, 0]
CX(mq, 0, 1)
assert mq._MuBit__state == [1/math.sqrt(2), -1/math.sqrt(2), 0, 0]