def test_optimize_large_circuit():
    (q0, q1, q2) = cirq.LineQubit.range(3)
    c_orig = cirq.testing.nonoptimal_toffoli_circuit(q0, q1, q2)
    c_opt = optimized_circuit(c_orig)
    cirq.testing.assert_allclose_up_to_global_phase(c_orig.to_unitary_matrix(), c_opt.to_unitary_matrix(), atol=1e-07)
    assert (sum((1 for op in c_opt.all_operations() if (isinstance(op, cirq.GateOperation) and isinstance(op.gate, cirq.CZPowGate)))) == 10)
def test_optimize_large_circuit():
    (q0, q1, q2) = cirq.LineQubit.range(3)
    c_orig = cirq.testing.nonoptimal_toffoli_circuit(q0, q1, q2)
    c_opt = optimized_circuit(c_orig)
    cirq.testing.assert_allclose_up_to_global_phase(c_orig.to_unitary_matrix(), c_opt.to_unitary_matrix(), atol=1e-07)
    assert (sum((1 for op in c_opt.all_operations() if (isinstance(op, cirq.GateOperation) and isinstance(op.gate, cirq.CZPowGate)))) == 10)