Skip to content

Commit cd01c6f

Browse files
added test environment variables (#655)
which enables post-compilation pre-runtime configuring of the unit tests without hooking into QuEST's internal environment variable facilities. The macros... - TEST_MAX_NUM_QUBIT_PERMUTATIONS - TEST_MAX_NUM_SUPEROP_TARGETS - TEST_ALL_DEPLOYMENTS - TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS are now environment variables, along with new variable TEST_NUM_QUBITS_IN_QUREG which controls the size of the Quregs in the unit tests. With this commit, all preprocessors considered in #645 have become environment variables
1 parent eeedec7 commit cd01c6f

File tree

16 files changed

+248
-172
lines changed

16 files changed

+248
-172
lines changed

.github/workflows/test_free.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ jobs:
5454
build_dir: "build"
5555
depr_dir: "build/tests/deprecated"
5656

57-
# run all slow, rigorous tests (because runner is free)
58-
num_qubit_perms: 0
59-
test_all_deploys: ON
60-
6157
# perform the job
6258
steps:
6359
- name: Get QuEST
@@ -71,14 +67,13 @@ jobs:
7167
-DENABLE_MULTITHREADING=OFF
7268
-DENABLE_DEPRECATED_API=${{ matrix.version == 3 && 'ON' || 'OFF' }}
7369
-DFLOAT_PRECISION=${{ matrix.precision }}
74-
-DTEST_ALL_DEPLOYMENTS=${{ env.test_all_deploys }}
75-
-DTEST_MAX_NUM_QUBIT_PERMUTATIONS=${{ env.num_qubit_perms }}
7670
7771
# force 'Release' build (needed by MSVC to enable optimisations)
7872
- name: Compile
7973
run: cmake --build ${{ env.build_dir }} --config Release --parallel
8074

81-
# run v4 unit tests in random order, excluding the integration tests
75+
# run v4 unit tests in random order, excluding the integration tests,
76+
# using the default environment variables (e.g. test all permutations)
8277
# TODO:
8378
# ctest currently doesn't know of our Catch2 tags, so we
8479
# are manually excluding each integration test by name

.github/workflows/test_paid.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090

9191
# tests will be non-comprehensive/faster to save $$$
9292
num_qubit_perms: 10
93-
test_all_deploys: OFF
93+
test_all_deploys: 0
9494

9595
# perform the job
9696
steps:
@@ -139,6 +139,12 @@ jobs:
139139
- name: Compile
140140
run: cmake --build ${{ env.build_dir }} --parallel
141141

142+
# specifying only env-vars with non-default values
143+
- name: Configure tests with environment variables
144+
run: |
145+
echo "TEST_MAX_NUM_QUBIT_PERMUTATIONS=${{ env.num_qubit_perms }}" >> $GITHUB_ENV
146+
echo "TEST_ALL_DEPLOYMENTS=${{ env.test_all_deploys }}" >> $GITHUB_ENV
147+
142148
# cannot use ctests when distributed, grr!
143149
- name: Run multithreaded + distributed v4 tests (16 nodes, 4 threads eeach)
144150
if: ${{ matrix.mpi == 'ON' }}
@@ -206,11 +212,11 @@ jobs:
206212
# which will be shared between 4 MPI processes
207213
# (no --oversubscribe flag necessary on MPICH)
208214
num_mpi_nodes: 4
209-
mpi_share_gpu: ON
215+
mpi_share_gpu: 1
210216

211217
# we will test all combinations of deployments
212218
# (e.g. CPU + MPI vs GPU), repeated 5 times each
213-
test_all_deploys: ON
219+
test_all_deploys: 1
214220
test_repetitions: 5
215221

216222
# perform the job
@@ -255,16 +261,17 @@ jobs:
255261
-DENABLE_CUDA=${{ matrix.cuda }}
256262
-DENABLE_CUQUANTUM=${{ matrix.cuquantum }}
257263
-DCMAKE_CUDA_ARCHITECTURES=${{ env.cuda_arch }}
258-
-DTEST_ALL_DEPLOYMENTS=${{ env.test_all_deploys }}
259-
-DTEST_NUM_MIXED_DEPLOYMENT_REPETITIONS=${{ env.test_repetitions }}
260264
-DCMAKE_CXX_FLAGS=${{ matrix.mpi == 'ON' && matrix.cuda == 'ON' && '-fno-lto' || '' }}
261265
262266
- name: Compile
263267
run: cmake --build ${{ env.build_dir }} --parallel
264268

265-
# permit use of single GPU by multiple MPI processes (detriments performance)
266-
- name: Set env-var to permit GPU sharing
267-
run: echo "PERMIT_NODES_TO_SHARE_GPU=${{ env.mpi_share_gpu }}" >> $GITHUB_ENV
269+
# specify only env-vars with non-default values
270+
- name: Configure tests with environment variables
271+
run: |
272+
echo "TEST_ALL_DEPLOYMENTS=${{ env.test_all_deploys }}" >> $GITHUB_ENV
273+
echo "TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS=${{ env.test_repetitions }}" >> $GITHUB_ENV
274+
echo "PERMIT_NODES_TO_SHARE_GPU=${{ env.mpi_share_gpu }}" >> $GITHUB_ENV
268275
269276
# cannot use ctests when distributed, grr!
270277
- name: Run GPU + distributed v4 mixed tests (4 nodes sharing 1 GPU)

CMakeLists.txt

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -123,65 +123,6 @@ option(
123123
ON
124124
)
125125

126-
string(CONCAT DESCRIPTON_OF_TEST_MAX_NUM_QUBIT_PERMUTATIONS # for multiline description
127-
"The maximum number of control and target qubit permutations under which to unit test each function. "
128-
"Set to 0 (default) to test all permutations, or to a positive integer (e.g. 50) to accelerate the unit tests. "
129-
"This is used to accelerate the v4 unit tests, and has no effect when ENABLE_TESTING is OFF, nor on the v3 deprecated tests."
130-
)
131-
set(TEST_MAX_NUM_QUBIT_PERMUTATIONS 0
132-
CACHE
133-
STRING
134-
"${DESCRIPTON_OF_TEST_MAX_NUM_QUBIT_PERMUTATIONS}"
135-
)
136-
if (ENABLE_TESTING)
137-
set(PERM_STRING "${TEST_MAX_NUM_QUBIT_PERMUTATIONS} random")
138-
if (TEST_MAX_NUM_QUBIT_PERMUTATIONS EQUAL 0)
139-
set(PERM_STRING "all")
140-
endif()
141-
message(STATUS "Tests will use ${PERM_STRING} qubit permutations. Set TEST_MAX_NUM_QUBIT_PERMUTATIONS to modify.")
142-
endif()
143-
144-
string(CONCAT DESCRIPTON_OF_TEST_MAX_NUM_SUPEROP_TARGETS # for multiline description
145-
"The maximum number of superoperator targets for which to unit test functions mixKrausMap and mixSuperOp. "
146-
"This is computationally equivalent to simulating unitaries with double the number of targets upon a density matrix. "
147-
"Set to 0 to test all sizes which is likely prohibitively slow, or to a positive integer (e.g. the default of 4) to accelerate the unit tests. "
148-
"This is used to accelerate the v4 unit tests, and has no effect when ENABLE_TESTING is OFF, nor on the v3 deprecated tests."
149-
)
150-
set(TEST_MAX_NUM_SUPEROP_TARGETS 4
151-
CACHE
152-
STRING
153-
"${DESCRIPTON_OF_TEST_MAX_NUM_SUPEROP_TARGETS}"
154-
)
155-
if (ENABLE_TESTING)
156-
set(PERM_STRING "${TEST_MAX_NUM_SUPEROP_TARGETS} random")
157-
if (TEST_MAX_NUM_SUPEROP_TARGETS EQUAL 0)
158-
set(PERM_STRING "all")
159-
endif()
160-
message(STATUS "Tests will use superoperators of up to ${PERM_STRING} qubits. Set TEST_MAX_NUM_SUPEROP_TARGETS to modify.")
161-
endif()
162-
163-
set(TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS 10
164-
CACHE
165-
STRING
166-
"The number of times (minimum=1) to repeat each mixed-deployment unit test for each deployment combination."
167-
)
168-
if (ENABLE_TESTING)
169-
if (TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS LESS_EQUAL 0)
170-
message(FATAL_ERROR "Cannot set TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS <= 0. Must be at least 1.")
171-
endif()
172-
message(STATUS "Tests will repeat each mixed-deployment unit test ${TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS} times. Set TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS to modify.")
173-
endif()
174-
175-
string(CONCAT DESCRIPTION_OF_TEST_ALL_DEPLOYMENTS # for multiline description
176-
"Whether unit tests will be run using all possible deployment combinations (i.e. OpenMP, CUDA, MPI) in-turn (ON), "
177-
"or only once using all available deployments simultaneously (OFF). Turned ON by default. "
178-
"This is used to accelerate the v4 unit tests, and has no effect when ENABLE_TESTING is OFF, nor on the v3 deprecated tests."
179-
)
180-
option(TEST_ALL_DEPLOYMENTS "${DESCRIPTION_OF_TEST_ALL_DEPLOYMENTS}" ON)
181-
if (ENABLE_TESTING)
182-
message(STATUS "Testing all deployments is turned ${TEST_ALL_DEPLOYMENTS}. Set TEST_ALL_DEPLOYMENTS to modify.")
183-
endif()
184-
185126
# Multithreading
186127
option(
187128
ENABLE_MULTITHREADING

docs/cmake.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ make
5555
| `ENABLE_TESTING` | (`OFF`), `ON` | Determines whether to additionally build QuEST's unit and integration tests. If built, tests can be run from the `build` directory with `make test`, or `ctest`, or manually launched with `./tests/tests` which enables distribution (i.e. `mpirun -np 8 ./tests/tests`) |
5656
| `ENABLE_DEPRECATED_API` | (`OFF`), `ON` | As described above. When enabled alongside testing, the `v3 deprecated` unit tests will additionally be compiled and can be run from within `build` via `cd tests/deprecated; ctest`, or manually launched with `./tests/deprecated/dep_tests` (enabling distribution, as above).
5757
| `DOWNLOAD_CATCH2` | (`ON`), `OFF` | QuEST's tests require Catch2. By default, if you don't have Catch2 installed (or CMake doesn't find it) it will be downloaded from Github and built for you. If you don't want that to happen, for example because you _do_ have Catch2 installed, set this to `OFF`. |
58-
| `TEST_MAX_NUM_QUBIT_PERMUTATIONS` | (`0`), Integer | Determines the maximum number of control and target qubit permutations with which to test each API function. Set to `0` to test all permutations, or to a positive integer (e.g. `50`) to accelerate the unit tests. |
59-
| `TEST_MAX_NUM_SUPEROP_TARGETS` | (`4`), Integer | Determines the maximum number of superoperator targets in the unit tests (for functions `mixKrausMap` and `mixSuperOp`). Set to `0` to impose no maximum (which is extraordinarily slow), or a positive integer (e.g. `3`) to accelerate the unit tests. |
60-
| `TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS` | (`10`), Integer | Determines the number of times (minimum of `1`) to repeat the randomised unit tests of functions which accept multiple distinctly-deployed `Qureg`s. Set to a small, positive integer to accelerate mixed-deployment unit tests. |
61-
| `TEST_ALL_DEPLOYMENTS` | (`ON`), `OFF` | Determines whether unit tests will be repeatedly run using all possible combinations of available `Qureg` deployments (i.e. `OpenMP` and/or `CUDA` and/or `MPI`), else only once using all available deployments simultaneously. Set to `OFF` to accelerate unit tests. |
58+
59+
> As of `v4.2`, macros which configure the unit tests such as `TEST_MAX_NUM_QUBIT_PERMUTATIONS` have become environment variables specified before launch. See [`launch.md`](launch.md)
6260
6361
---------------------------
6462

docs/launch.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ Test project /build
216216
Alas tests launched in this way cannot be deployed with distribution.
217217

218218

219+
#### Environment variables
220+
221+
The `v4` unit tests make use of the below, optional environment variables to control their rigour and runtime.
222+
223+
224+
| Environment variable | Default | Description |
225+
| -------- | ------- | ------- |
226+
| `TEST_NUM_QUBITS_IN_QUREG` | `6` | The number of qubits in the Qureg(s) undergoing unit testing. In addition to operation upon larger Quregs being exponentially slower, beware that more qubits permit more variations and permutations of input parameters like target qubits, factorially increasing the number of tests per operation. |
227+
| `TEST_MAX_NUM_QUBIT_PERMUTATIONS` | `0` | The maximum number of control and target qubit permutations under which to unit test each function. Set to `0` (default) to test all permutations, or to a positive integer (e.g. `50`) to accelerate the unit tests. See more info [here](https://quest-kit.github.io/QuEST/group__testutilsconfig.html#gac5adcc10bd26c56f20344f5ae3d9ba41). |
228+
| `TEST_MAX_NUM_SUPEROP_TARGETS` | `4` | The maximum number of superoperator targets for which to unit test functions `mixKrausMap()` and `mixSuperOp()`. These are computationally equivalent to simulating unitaries with double the number of targets upon a density matrix. Set to `0` to test all sizes which is likely prohibitively slow, or to a positive integer (e.g. the default of `4`) to accelerate the unit tests. |
229+
| `NUM_MIXED_DEPLOYMENT_REPETITIONS` | `10` | The number of times (minimum of `1`) to repeat each random mixed-deployment unit test for each deployment combination. |
230+
| `TEST_ALL_DEPLOYMENTS` | `1` | Whether unit tests will be run using all possible deployment combinations (i.e. OpenMP, CUDA, MPI) in-turn (`=1`), or only once using all available deployments simultaneously (`=0`). |
231+
232+
233+
219234

220235
<!-- permit doxygen to reference section -->
221236
<a id="launch_v3"></a>
@@ -256,7 +271,7 @@ QuEST execution can be configured prior to runtime using the below [environment
256271
- [`PERMIT_NODES_TO_SHARE_GPU`](https://quest-kit.github.io/QuEST/group__modes.html#ga7e12922138caa68ddaa6221e40f62dda)
257272
- [`DEFAULT_VALIDATION_EPSILON`](https://quest-kit.github.io/QuEST/group__modes.html#ga55810d6f3d23de810cd9b12a2bbb8cc2)
258273

259-
274+
Note the unit tests in the preceding section accept additional environment variables.
260275

261276

262277
---------------------

tests/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# @author Oliver Thomson Brown
2-
# @author Tyson Jones (macros and MPI ctests)
32

43
add_executable(tests
54
main.cpp
@@ -16,12 +15,5 @@ if (ENABLE_DEPRECATED_API)
1615
endif()
1716

1817

19-
# map test-related cmake vars to preprocessors
20-
target_compile_definitions(tests PRIVATE TEST_MAX_NUM_QUBIT_PERMUTATIONS=${TEST_MAX_NUM_QUBIT_PERMUTATIONS})
21-
target_compile_definitions(tests PRIVATE TEST_MAX_NUM_SUPEROP_TARGETS=${TEST_MAX_NUM_SUPEROP_TARGETS})
22-
target_compile_definitions(tests PRIVATE TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS=${TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS})
23-
target_compile_definitions(tests PRIVATE TEST_ALL_DEPLOYMENTS=$<BOOL:${TEST_ALL_DEPLOYMENTS}>)
24-
25-
2618
# let Catch2 register all tests with CTest
2719
catch_discover_tests(tests)

tests/main.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#include <string>
5151

5252
#include "quest.h"
53+
#include "tests/utils/config.hpp"
5354
#include "tests/utils/cache.hpp"
5455
#include "tests/utils/macros.hpp"
5556
#include "tests/utils/random.hpp"
@@ -95,8 +96,14 @@ class startListener : public Catch::EventListenerBase {
9596
std::cout << " GPU-sharing ok: " << env.isGpuSharingEnabled << std::endl;
9697
std::cout << " cuQuantum: " << env.isCuQuantumEnabled << std::endl;
9798
std::cout << " num nodes: " << env.numNodes << std::endl;
98-
std::cout << " num qubits: " << getNumCachedQubits() << std::endl;
99-
std::cout << " num qubit perms: " << TEST_MAX_NUM_QUBIT_PERMUTATIONS << std::endl;
99+
std::cout << std::endl;
100+
101+
std::cout << "Testing configuration:" << std::endl;
102+
std::cout << " test all deployments: " << getWhetherToTestAllDeployments() << std::endl;
103+
std::cout << " num qubits in qureg: " << getNumCachedQubits() << std::endl;
104+
std::cout << " max num qubit perms: " << getMaxNumTestedQubitPermutations() << std::endl;
105+
std::cout << " max num superop targs: " << getMaxNumTestedSuperoperatorTargets() << std::endl;
106+
std::cout << " num mixed-deploy reps: " << getNumTestedMixedDeploymentRepetitions() << std::endl;
100107
std::cout << std::endl;
101108

102109
std::cout << "Tested Qureg deployments:" << std::endl;

tests/unit/calculations.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "tests/utils/lists.hpp"
2424
#include "tests/utils/macros.hpp"
2525
#include "tests/utils/random.hpp"
26+
#include "tests/utils/config.hpp"
2627
#include "tests/utils/cache.hpp"
2728
#include "tests/utils/measure.hpp"
2829

@@ -412,7 +413,7 @@ TEST_CASE( "calcInnerProduct", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG ) {
412413
qmatrix refDM = getRefDensmatr();
413414
auto apiFunc = calcInnerProduct;
414415

415-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
416+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
416417

417418
SECTION( LABEL_STATEVEC LABEL_DELIMITER LABEL_STATEVEC ) {
418419

@@ -461,7 +462,7 @@ TEST_CASE( "calcFidelity", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG ) {
461462
qmatrix refDM = getRefDensmatr();
462463
auto apiFunc = calcFidelity;
463464

464-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
465+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
465466

466467
SECTION( LABEL_STATEVEC LABEL_DELIMITER LABEL_STATEVEC ) {
467468

@@ -503,7 +504,7 @@ TEST_CASE( "calcDistance", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG ) {
503504
qmatrix refDM = getRefDensmatr();
504505
auto apiFunc = calcDistance;
505506

506-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
507+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
507508

508509
SECTION( LABEL_STATEVEC LABEL_DELIMITER LABEL_STATEVEC ) {
509510

@@ -550,7 +551,7 @@ TEST_CASE( "calcExpecFullStateDiagMatr", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG )
550551
qmatrix refMatr = getRandomDiagonalHermitian(getNumCachedQubits());
551552
auto apiFunc = calcExpecFullStateDiagMatr;
552553

553-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
554+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
554555

555556
SECTION( LABEL_STATEVEC ) {
556557

@@ -579,7 +580,7 @@ TEST_CASE( "calcExpecNonHermitianFullStateDiagMatr", TEST_CATEGORY LABEL_MIXED_D
579580
qmatrix refMatr = getRandomDiagonalMatrix(getPow2(getNumCachedQubits()));
580581
auto apiFunc = calcExpecNonHermitianFullStateDiagMatr;
581582

582-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
583+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
583584

584585
SECTION( LABEL_STATEVEC ) {
585586

@@ -635,7 +636,7 @@ TEST_CASE( "calcExpecFullStateDiagMatrPower", TEST_CATEGORY LABEL_MIXED_DEPLOY_T
635636

636637
CAPTURE( exponent );
637638

638-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
639+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
639640

640641
SECTION( LABEL_STATEVEC ) {
641642

@@ -676,7 +677,7 @@ TEST_CASE( "calcExpecNonHermitianFullStateDiagMatrPower", TEST_CATEGORY LABEL_MI
676677

677678
CAPTURE( exponent );
678679

679-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
680+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
680681

681682
SECTION( LABEL_STATEVEC ) {
682683

tests/unit/decoherence.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "tests/utils/qvector.hpp"
1717
#include "tests/utils/qmatrix.hpp"
18+
#include "tests/utils/config.hpp"
1819
#include "tests/utils/cache.hpp"
1920
#include "tests/utils/compare.hpp"
2021
#include "tests/utils/convert.hpp"
@@ -276,7 +277,7 @@ TEST_CASE( "mixKrausMap", TEST_CATEGORY ) {
276277

277278
SECTION( LABEL_CORRECTNESS ) {
278279

279-
int maxFlag = TEST_MAX_NUM_SUPEROP_TARGETS;
280+
int maxFlag = getMaxNumTestedSuperoperatorTargets();
280281
int numQubits = getNumCachedQubits();
281282
int maxNumTargs = (maxFlag != 0 && numQubits > maxFlag)?
282283
maxFlag : numQubits;
@@ -305,7 +306,7 @@ TEST_CASE( "mixSuperOp", TEST_CATEGORY ) {
305306
SECTION( LABEL_CORRECTNESS ) {
306307

307308
int numQubits = getNumCachedQubits();
308-
int maxFlag = TEST_MAX_NUM_SUPEROP_TARGETS;
309+
int maxFlag = getMaxNumTestedSuperoperatorTargets();
309310
int maxNumTargs = (maxFlag != 0 && numQubits > maxFlag)?
310311
maxFlag : numQubits;
311312

@@ -336,7 +337,7 @@ TEST_CASE( "mixQureg", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG ) {
336337

337338
CAPTURE( prob );
338339

339-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
340+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
340341

341342
SECTION( LABEL_DENSMATR LABEL_DELIMITER LABEL_STATEVEC ) {
342343

tests/unit/operations.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <catch2/matchers/catch_matchers_string.hpp>
2323
#include <catch2/generators/catch_generators_range.hpp>
2424

25+
#include "tests/utils/config.hpp"
2526
#include "tests/utils/cache.hpp"
2627
#include "tests/utils/qvector.hpp"
2728
#include "tests/utils/qmatrix.hpp"
@@ -1738,7 +1739,7 @@ TEST_CASE( "multiplyFullStateDiagMatr", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG ) {
17381739
qmatrix refMatr = getRandomDiagonalMatrix(getPow2(numQubits));
17391740
auto apiFunc = multiplyFullStateDiagMatr;
17401741

1741-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
1742+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
17421743

17431744
SECTION( LABEL_STATEVEC ) {
17441745

@@ -1776,7 +1777,7 @@ TEST_CASE( "multiplyFullStateDiagMatrPower", TEST_CATEGORY LABEL_MIXED_DEPLOY_TA
17761777

17771778
CAPTURE( exponent );
17781779

1779-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
1780+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
17801781

17811782
SECTION( LABEL_STATEVEC ) {
17821783

@@ -1814,7 +1815,7 @@ TEST_CASE( "applyFullStateDiagMatr", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG ) {
18141815
qmatrix refMatr = getRandomDiagonalUnitary(numQubits);
18151816
auto apiFunc = applyFullStateDiagMatr;
18161817

1817-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
1818+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
18181819

18191820
SECTION( LABEL_STATEVEC ) {
18201821

@@ -1858,7 +1859,7 @@ TEST_CASE( "applyFullStateDiagMatrPower", TEST_CATEGORY LABEL_MIXED_DEPLOY_TAG )
18581859

18591860
CAPTURE( exponent );
18601861

1861-
GENERATE( range(0, TEST_NUM_MIXED_DEPLOYMENT_REPETITIONS) );
1862+
GENERATE( range(0, getNumTestedMixedDeploymentRepetitions()) );
18621863

18631864
if (!testRealExp)
18641865
setValidationEpsilon(0);

0 commit comments

Comments
 (0)