def test_qasm_qdef():
    # weaker test condition (str) since we don't have access to the actual class
    q = Qasm("def Q,0,Q", 'qubit q0', 'Q q0')
    Qgate = CreateOneQubitGate('Q')
    assert str(q.get_circuit()) == 'Q(0)'
    q = Qasm("def CQ,1,Q", 'qubit q0', 'qubit q1', 'CQ q0,q1')
    Qgate = CreateCGate('Q')
    assert str(q.get_circuit()) == 'C((1),Q(0))'
Esempio n. 2
0
 def qdef(self, name, ncontrols, symbol):
     from sympy.physics.quantum.circuitplot import CreateOneQubitGate, CreateCGate
     ncontrols = int(ncontrols)
     command = fixcommand(name)
     symbol = stripquotes(symbol)
     if ncontrols > 0:
         self.defs[command] = CreateCGate(symbol)
     else:
         self.defs[command] = CreateOneQubitGate(symbol)
def test_createc():
    Qgate = CreateCGate('Q')
    assert str(Qgate([1], 0)) == 'C((1),Q(0))'
Esempio n. 4
0
def test_createc():
    Qgate = CreateCGate("Q")
    assert str(Qgate([1], 0)) == "C((1),Q(0))"