Skip to content

Core ​

Tableau, simulator, Pauli and circuit basics

29/29 passed in 296ms

TestWhat it doesResult
test_versionimport qliff works and its version matches Cargo.toml [package].✅ pass
test_gate_groupsGates map stabilizer groups: |0>, |000>, H, S, Z, Y, S_DAG, Bell, GHZ via flattened CX pairs, CZ on |++>, SWAP.✅ pass
test_random_clifford_inverseA random Clifford followed by its inverse returns to |0...0>.✅ pass
test_bad_targetsOut-of-range qubits, a repeated or unpaired CX target, a wrong-width Pauli and a record before any measurement raise ValueError.✅ pass
test_fidelityfidelity: a Bell state and its copy 1, |Phi+> vs |Phi-> 0, |0> vs |+> 0.5.✅ pass
test_measure_paulimeasure() of ZZ and XX on a Bell state is a deterministic +1; XX on |00> is a coin flip.✅ pass
test_resetR and MR leave |0>, MR reports the value before the reset, and the qubit is reusable.✅ pass
test_teleportTeleporting |0>, |1>, |+>, |-> through a Bell pair gives <Z> or <X> = +-1 on q2.✅ pass
test_bell_correlationBell-pair outcomes are perfectly correlated.✅ pass
test_composite_gatesSX, SX_DAG, MX, MY and MZ act as their primitive sequences on a Simulator and on a Circuit (method or append by name); each basis measurement records one bit.✅ pass
test_ghz_statisticsGHZ_3 collapses only to 000 or 111, about 50:50.✅ pass
test_plus_statistics|+> measures 0/1 about 50:50.✅ pass
test_record|0> measures 0, X|0> measures 1, and the record keeps call order.✅ pass
test_repeatableMeasuring the same qubit twice agrees.✅ pass
test_peekpeek: <Z> = +1 on |0>, -1 on |1>, 0 on |+>; <X> = +1 on |+>, -1 on |->; a '-' prefix flips it; Bell <YY> = -1, <ZI> = 0; a PauliString argument works, and qliff.expectation agrees.✅ pass
test_commutationX and Z anticommute; XX and ZZ commute.✅ pass
test_from_sparsefrom_sparse places single-qubit Paulis.✅ pass
test_parse_repr_roundtripParsing then repr is the identity for signed Paulis.✅ pass
test_productProducts track the i phase: XY = +iZ, YX = -iZ, Z*Z = +I, (-X)*Y = -iZ; the identity is neutral.✅ pass
test_bell_matches_directA Bell circuit reproduces the directly-built Bell state.✅ pass
test_custom_channel_round_tripsA custom Channel added via noise() is sampled like a built-in one.✅ pass
test_fluent_matches_appendFluent gate methods build the same instructions as append.✅ pass
test_infers_num_qubitsnum_qubits grows to cover the targets used.✅ pass
test_reproducible_with_seedThe same seed gives the same measurement record.✅ pass
test_reset_collapses_partnerSampling H(0) CX(0,1) R(0) M(1) reads 1 on about half the shots: the reset collapses the Bell partner at random.✅ pass
test_run_rejects_noiserun() is for noiseless circuits and raises on a noise instruction.✅ pass
test_deferred_recordsThe per-shot core buffers measurements: a gate on a buffered qubit flushes it first (X; MR resets q0, so the CX flips nothing), and buffered MRs survive a gate elsewhere, so every record matches the eager order.✅ pass
test_sample_batch_reproducibleThe per-shot core is deterministic in its seed.✅ pass
test_signed_reset_branch_and_signA hand-built signed {I, -Z, R} table resets q0 on its R branch and gives both signs, |weight| = gamma = 1.1 and mean weight ~ 0.9.✅ pass