Skip to content

test: add integration tests for basic circuit gate operations#9

Open
rayair250-droid wants to merge 1 commit into
cq-lib:mainfrom
rayair250-droid:test/circuit-gate-ops-integration
Open

test: add integration tests for basic circuit gate operations#9
rayair250-droid wants to merge 1 commit into
cq-lib:mainfrom
rayair250-droid:test/circuit-gate-ops-integration

Conversation

@rayair250-droid

Copy link
Copy Markdown

Closes #4.

Adds tests/python/circuit/test_gate_ops_integration.py with integration coverage for the core circuit gate-construction API:

  • Single-qubit gatesH, X, Y, Z matrices checked against standard references, plus H·H == I.
  • Bell circuitCircuit(2).h(0).cx(0, 1) records the expected operations and produces a unitary (4, 4) matrix.
  • Parameterized rotationrx(0, 0) == I, rx unitary for arbitrary angles, and symbolic rx(theta) via assign_parameters (RX(pi) == -i·X).
  • Dimensionsto_matrix() shape scales as 2**n; empty circuit has no operations.

Multi-qubit assertions are stated as convention-independent properties (unitarity, shape, recorded op names) so they hold regardless of the internal qubit-ordering endianness.

Verified locally: built the Python binding with maturin develop and ran the new file — 14 passed.

Adds coverage for single-qubit gate matrices (H/X/Y/Z), Bell circuit
construction and unitarity, parameterized RX with assign_parameters, and
to_matrix dimension scaling. Multi-qubit assertions use convention-independent
properties (unitarity, shape, recorded op names) so they hold regardless of
internal qubit-ordering. Closes cq-lib#4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Python integration tests for quantum circuit API

1 participant