def test_decompose_toffoli(self):
    'Test decompose CCX.\n        '
    qr1 = QuantumRegister(2, 'qr1')
    qr2 = QuantumRegister(1, 'qr2')
    circuit = QuantumCircuit(qr1, qr2)
    circuit.ccx(qr1[0], qr1[1], qr2[0])
    dag = circuit_to_dag(circuit)
    pass_ = Decompose(ToffoliGate)
    after_dag = pass_.run(dag)
    op_nodes = after_dag.op_nodes()
    self.assertEqual(len(op_nodes), 15)
    for node in op_nodes:
        self.assertIn(node.name, ['h', 't', 'tdg', 'cx'])
Test decompose CCX.
def test_decompose_toffoli(self):
    '\n        '
    qr1 = QuantumRegister(2, 'qr1')
    qr2 = QuantumRegister(1, 'qr2')
    circuit = QuantumCircuit(qr1, qr2)
    circuit.ccx(qr1[0], qr1[1], qr2[0])
    dag = circuit_to_dag(circuit)
    pass_ = Decompose(ToffoliGate)
    after_dag = pass_.run(dag)
    op_nodes = after_dag.op_nodes()
    self.assertEqual(len(op_nodes), 15)
    for node in op_nodes:
        self.assertIn(node.name, ['h', 't', 'tdg', 'cx'])