Skip to content

7. Unit testing

Vlad Gheorghiu edited this page Apr 5, 2024 · 9 revisions

Quantum++ was extensively tested on multiple flavours of Linux, macOS/OS X, FreeBSD, Windows, Solaris 11.x via a suite of unit tests written using GoogleTest. The source code of the unit tests is located in unit_tests/tests.

To build the unit tests, execute

cmake -B build
cmake --build build --target=unit_tests --parallel 8

The command above build the unit tests executable in ./build/unit_tests/unit_tests. The --parallel 8 instructs CMake to build in parallel using 8 threads, modify accordingly.

Tu run the unit tests, execute

ctest --test-dir build

Note that qpp::Timer<> tests or tests related to random functions such as qpp::rand() may sometime (very rarely) fail, due to timing imprecision or statistical errors. Such behaviour is perfectly normal.

Clone this wiki locally