Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🧪  Tests

This folder contains QuEST's extensive tests. See compile.md and launch.md to get them running.

The subdirectories are:

  • utils containing test utilities, including non-optimised functions against which QuEST output is compared.
  • unit containing unit tests which test individual QuEST functions in isolation, under their entire input domains (where feasible).
  • integration containing integration tests which test multiple QuEST functions working at scale.
  • deprecated containing v3'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) );
        }
    }
}