43#include <catch2/catch_session.hpp>
44#include <catch2/catch_test_macros.hpp>
45#include <catch2/reporters/catch_reporter_event_listener.hpp>
46#include <catch2/reporters/catch_reporter_registrars.hpp>
53#include "tests/utils/config.hpp"
54#include "tests/utils/cache.hpp"
55#include "tests/utils/macros.hpp"
56#include "tests/utils/random.hpp"
64extern "C" void validationErrorHandler(
const char* errFunc,
const char* errMsg) {
66 throw std::runtime_error(std::string(errFunc) +
": " + std::string(errMsg));
75class startListener :
public Catch::EventListenerBase {
77 using Catch::EventListenerBase::EventListenerBase;
78 void testRunStarting(Catch::TestRunInfo
const&)
override {
90 std::cout << std::endl;
91 std::cout <<
"QuEST execution environment:" << std::endl;
93 std::cout <<
" multithreaded: " << env.isMultithreaded << std::endl;
94 std::cout <<
" distributed: " << env.isDistributed << std::endl;
95 std::cout <<
" GPU-accelerated: " << env.isGpuAccelerated << std::endl;
96 std::cout <<
" GPU-sharing ok: " << env.isGpuSharingEnabled << std::endl;
97 std::cout <<
" cuQuantum: " << env.isCuQuantumEnabled << std::endl;
98 std::cout <<
" num nodes: " << env.numNodes << std::endl;
99 std::cout << std::endl;
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;
107 std::cout << std::endl;
109 std::cout <<
"Tested Qureg deployments:" << std::endl;
110 for (
auto& [label, qureg]: getCachedStatevecs())
111 std::cout <<
" " << label << std::endl;
112 std::cout << std::endl;
116CATCH_REGISTER_LISTENER(startListener)
123int main(
int argc,
char* argv[]) {
131 setRandomTestStateSeeds();
134 createCachedQuregs();
135 createCachedFullStateDiagMatrs();
139 std::cout.rdbuf(
nullptr);
142 int result = Catch::Session().run( argc, argv );
144 destroyCachedFullStateDiagMatrs();
145 destroyCachedQuregs();
void setInputErrorHandler(void(*callback)(const char *func, const char *msg))
const int FLOAT_PRECISION