def test_measurement_keys_repeat(scheduler): circuit = Circuit() meas = XmonMeasurementGate('a') circuit.append([meas.on(Q1), X.on(Q1), X.on(Q2), meas.on(Q2)]) simulator = xmon_simulator.XmonSimulator() with pytest.raises(ValueError, message='Repeated Measurement key a'): run(simulator, circuit, scheduler)
def test_measurement_multiple_measurements_qubit_order(scheduler): circuit = Circuit() measure_a = XmonMeasurementGate('a') measure_b = XmonMeasurementGate('b') circuit.append(X(Q1)) circuit.append([measure_a.on(Q1, Q2)]) circuit.append([measure_b.on(Q2, Q1)]) simulator = xmon_simulator.XmonSimulator() result = run(simulator, circuit, scheduler) np.testing.assert_equal(result.measurements['a'], [[True, False]]) np.testing.assert_equal(result.measurements['b'], [[False, True]])
def test_measurement_qubit_order(scheduler): circuit = Circuit() meas = XmonMeasurementGate(key='') circuit.append(X(Q2)) circuit.append(X(Q1)) circuit.append([meas.on(Q1, Q3, Q2)]) simulator = xmon_simulator.XmonSimulator() result = run(simulator, circuit, scheduler) np.testing.assert_equal(result.measurements[''], [[True, False, True]])