The Quantum Exact Simulation Toolkit v4.1.0
Loading...
Searching...
No Matches
 TEST_CASE ("getQcomp", TEST_CATEGORY)
 
 TEST_CASE ("complex arithmetic", TEST_CATEGORY)
 

Detailed Description

Function Documentation

◆ TEST_CASE() [1/2]

TEST_CASE ( "complex arithmetic" ,
TEST_CATEGORY  )

Definition at line 66 of file types.cpp.

66 {
67
68 SECTION( LABEL_CORRECTNESS ) {
69
70 qcomp x;
71 x = 1 + 2_i;
72 x += 3 - 4_i;
73 x -= - 5 + 6_i;
74 x *= - 7 - 8_i;
75 x /= 9 + 10_i;
76
77 qcomp ref = getQcomp(-1303/181., 1126/181.);
78 REQUIRE_AGREE( x, ref );
79 }
80
81 SECTION( LABEL_VALIDATION ) {
82
83 // no validation!
84 SUCCEED( );
85 }
86}
static qcomp getQcomp(qreal re, qreal im)
Definition types.h:91

◆ TEST_CASE() [2/2]

TEST_CASE ( "getQcomp" ,
TEST_CATEGORY  )

TESTS

Definition at line 46 of file types.cpp.

46 {
47
48 SECTION( LABEL_CORRECTNESS ) {
49
50 qreal re = getRandomReal(-10, 10);
51 qreal im = getRandomReal(-10, 10);
52
53 qcomp comp = getQcomp(re, im);
54 REQUIRE( std::real(comp) == re );
55 REQUIRE( std::imag(comp) == im );
56 }
57
58 SECTION( LABEL_VALIDATION ) {
59
60 // no validation!
61 SUCCEED( );
62 }
63}
qreal getRandomReal(qreal min, qreal maxExcl)
Definition random.cpp:63