Skip to content

Commit

Permalink
Add reproducer for array bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
taalexander committed Jun 11, 2024
1 parent f6d695f commit d63e13e
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def build(self):
cmake = CMake(self)
cmake.configure()

use_monitor = False
if self.should_build:
# Note that if a job does not produce output for a longer period of
# time, then Travis will cancel that job.
Expand Down
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -680,3 +680,7 @@ add_test(NAME t00335
COMMAND ${BASH} -c "${OPENQASM_TEST_PROGRAM} -I${OPENQASM_TEST_INCDIR} ${OPENQASM_TEST_SRCDIR}/test-nested-elseif.qasm > ${CMAKE_BINARY_DIR}/tests/test-nested-elseif.qasm.out 2>&1")
add_test(NAME t00336
COMMAND ${BASH} -c "${OPENQASM_TEST_PROGRAM} -I${OPENQASM_TEST_INCDIR} ${OPENQASM_TEST_SRCDIR}/test-multi-nested-elseif.qasm > ${CMAKE_BINARY_DIR}/tests/test-multi-nested-elseif.qasm.out 2>&1")
add_test(NAME t00337
COMMAND ${BASH} -c "${OPENQASM_TEST_PROGRAM} -I${OPENQASM_TEST_INCDIR} ${OPENQASM_TEST_SRCDIR}/test-array-17.qasm > ${CMAKE_BINARY_DIR}/tests/test-array-17.qasm.out 2>&1")
add_test(NAME t00338
COMMAND ${BASH} -c "${OPENQASM_TEST_PROGRAM} -I${OPENQASM_TEST_INCDIR} ${OPENQASM_TEST_SRCDIR}/test-array-18.qasm > ${CMAKE_BINARY_DIR}/tests/test-array-18.qasm.out 2>&1")
21 changes: 21 additions & 0 deletions tests/src/test-array-17.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
OPENQASM 3.0;


gate phase(lambda) q {
U(0, 0, lambda) q;
}

qubit a;

array[qubit, 16] aarray;

input array[angle, 16] aa;


phase(aa[0]) a;

phase(aa[0]) aarray;

angle assign = aa[0];

phase(assign) a;
26 changes: 26 additions & 0 deletions tests/src/test-array-18.qasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
OPENQASM 3;

gate rz(theta) q {}

qubit $0;

input angle angle_p;
input float[64] float_p;

input array[angle, 20000] array_angle_p;
input array[float[64], 20000] array_float_p;

// Access value directly
rz(angle_p) $0;
rz(float_p) $0;

// Access value through array reference
rz(array_angle_p[0]) $0;
rz(array_float_p[0]) $0;

// Access value through intermediate assignment
float[64] intermediate_angle = array_angle_p[0];
float[64] intermediate_float = array_float_p[0];

rz(intermediate_angle);
rz(intermediate_float);

0 comments on commit d63e13e

Please sign in to comment.