# cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent¶

cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent(actual: cirq.circuits.circuit.Circuit, reference: cirq.circuits.circuit.Circuit, atol: float) → None[source]

Determines if two circuits have equivalent effects.

The circuits can contain measurements, but the measurements must be at the
end of the circuit. Circuits are equivalent if, for all possible inputs,
their outputs (classical bits for lines terminated with measurement and
qubits for lines without measurement) are observationally indistinguishable
up to a tolerance. Note that under this definition of equivalence circuits
that differ solely in the overall phase of the post-measurement state of
measured qubits are considered equivalent.
For example, applying an extra Z gate to an unmeasured qubit changes the
effect of a circuit. But inserting a Z gate operation just before a
measurement does not.
Parameters
• actual – The circuit that was actually computed by some process.

• reference – A circuit with the correct function.

• atol – Absolute error tolerance.