The Quantum Exact Simulation Toolkit v4.2.0
Loading...
Searching...
No Matches
macros.hpp
1/** @file
2 * @author Tyson Jones
3 *
4 * @defgroup testutilsmacros Macros
5 * @ingroup testutils
6 * @brief
7 * Macros used by the tests and testing utilities.
8 * @{
9 */
10
11#ifndef MACROS_HPP
12#define MACROS_HPP
13
14#include <catch2/catch_test_macros.hpp>
15
16
17/*
18 * preconditions to the internal unit testing functions are checked using
19 * DEMAND rather than Catch2's REQUIRE, so that they are not counted in the
20 * total unit testing statistics (e.g. number of checks passed).
21 */
22
23#define DEMAND( cond ) do { if (!(cond)) { FAIL( ); } } while (0)
24
25
26// section labels
27
28#define LABEL_CORRECTNESS "correctness"
29#define LABEL_VALIDATION "validation"
30#define LABEL_STATEVEC "statevector"
31#define LABEL_DENSMATR "densitymatrix"
32#define LABEL_C_INTERFACE "C interface"
33#define LABEL_CPP_INTERFACE "C++ interface"
34
35#define LABEL_DELIMITER ", "
36
37#define LABEL_UNIT_TAG "[unit]"
38#define LABEL_MIXED_DEPLOY_TAG "[mixed]"
39#define LABEL_INTEGRATION_TAG "[integration]"
40
41
42// detect LLVM address sanitizer (on GCC and Clang only)
43#if defined(__SANITIZE_ADDRESS__)
44 #define SANITIZER_IS_ACTIVE
45#elif defined(__has_feature)
46 #if __has_feature(address_sanitizer)
47 #define SANITIZER_IS_ACTIVE
48 #endif
49#endif
50
51
52#endif // MACROS_HPP
53
54/** @} (end defgroup) */