Skip to content

Add test for the add_dd_and_align_right in 2D GHZ state generation #7784

@pavoljuhas

Description

@pavoljuhas

Describe the issue

Follow-up to #7767
(found by internal mutants testing, cl/836063329)

The add_dd_and_align_right argument to generate_2d_ghz_circuit applies a series of transformations to the GHZ circuit, but the result is never tested.

For example, after the following patch to ignore the add_dd_and_align_right -

diff --git a/cirq-core/cirq/experiments/ghz_2d.py b/cirq-core/cirq/experiments/ghz_2d.py
index 48394af6..56885276 100644
--- a/cirq-core/cirq/experiments/ghz_2d.py
+++ b/cirq-core/cirq/experiments/ghz_2d.py
@@ -145,6 +145,6 @@ def generate_2d_ghz_circuit(
     circuit = circuits.Circuit(ghz_ops)

     if add_dd_and_align_right:
-        return _transform_circuit(circuit)
+        return circuit
     else:
         return circuit

the pytest cirq-core/cirq/experiments/ghz_2d_test.py passes without a problem.
On a quick look at the ghz_2d_test.py, there seems to be no check of the add_dd_and_align_right effects.

Please add a test to verify the effects of add_dd_and_align_right.

Tell us the version of Cirq where this happens

1.7.0.dev0 at 34cddd4.

Metadata

Metadata

Assignees

Labels

area/testingkind/healthFor CI/testing/release process/refactoring/technical debt items

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions