This folder contains QuEST's extensive tests. See compile.md and launch.md to get them running.
The subdirectories are:
utilscontaining test utilities, including non-optimised functions against which QuEST output is compared.unitcontaining unit tests which test individual QuEST functions in isolation, under their entire input domains (where feasible).integrationcontaining integration tests which test multiple QuEST functions working at scale.deprecatedcontainingv3's tests and utilities, only used when explicitly activated.
The tests use Catch2 and are generally structured as
TEST_CASE( "someApiFunc", "[funcs]" ) {
PREPARE_TEST(...)
SECTION( "correctness" ) {
SECTION( "statevector" ) {
auto a = getApiResult();
auto b = getReferenceResult();
REQUIRE_AGREE(a, b);
}
SECTION( "density matrix" ) {
auto a = getApiResult();
auto b = getReferenceResult();s
}
}
SECTION( "validation" ) {
SECTION( "some way to mess it up" ) {
REQUIRE_THROWS( someApiFunc(badArgs) );
}
}
}