10#include "quest/include/quest.h"
12#include <catch2/catch_test_macros.hpp>
13#include <catch2/matchers/catch_matchers_string.hpp>
15#include "tests/utils/qvector.hpp"
16#include "tests/utils/qmatrix.hpp"
17#include "tests/utils/compare.hpp"
18#include "tests/utils/convert.hpp"
19#include "tests/utils/evolve.hpp"
20#include "tests/utils/linalg.hpp"
21#include "tests/utils/lists.hpp"
22#include "tests/utils/macros.hpp"
23#include "tests/utils/random.hpp"
25using Catch::Matchers::ContainsSubstring;
33#define TEST_CATEGORY \
34 LABEL_UNIT_TAG "[environment]"
48 SECTION( LABEL_CORRECTNESS ) {
54 SECTION( LABEL_VALIDATION ) {
56 REQUIRE_THROWS_WITH(
initQuESTEnv(), ContainsSubstring(
"already been initialised") );
61TEST_CASE(
"initCustomQuESTEnv", TEST_CATEGORY ) {
63 SECTION( LABEL_CORRECTNESS ) {
69 SECTION( LABEL_VALIDATION ) {
71 REQUIRE_THROWS_WITH(
initCustomQuESTEnv(0,0,0), ContainsSubstring(
"already been initialised") );
79TEST_CASE(
"finalizeQuESTEnv", TEST_CATEGORY ) {
81 SECTION( LABEL_CORRECTNESS ) {
88 SECTION( LABEL_VALIDATION ) {
97TEST_CASE(
"syncQuESTEnv", TEST_CATEGORY ) {
99 SECTION( LABEL_CORRECTNESS ) {
105 SECTION( LABEL_VALIDATION ) {
114TEST_CASE(
"isQuESTEnvInit", TEST_CATEGORY ) {
116 SECTION( LABEL_CORRECTNESS ) {
122 SECTION( LABEL_VALIDATION ) {
130TEST_CASE(
"getQuESTEnv", TEST_CATEGORY ) {
132 SECTION( LABEL_CORRECTNESS ) {
136 REQUIRE( (env.isMultithreaded == 0 || env.isMultithreaded == 1) );
137 REQUIRE( (env.isGpuAccelerated == 0 || env.isGpuAccelerated == 1) );
138 REQUIRE( (env.isDistributed == 0 || env.isDistributed == 1) );
140 REQUIRE( env.rank >= 0 );
141 REQUIRE( env.numNodes >= 0 );
143 if (!env.isDistributed) {
144 REQUIRE( env.rank == 0 );
145 REQUIRE( env.numNodes == 1 );
148 bool isNumNodesPow2 = ((env.numNodes & (env.numNodes - 1)) == 0);
149 REQUIRE( isNumNodesPow2 );
152 SECTION( LABEL_VALIDATION ) {
void initCustomQuESTEnv(int useDistrib, int useGpuAccel, int useMultithread)
TEST_CASE("initQuESTEnv", TEST_CATEGORY)