Skip to content

Commit

Permalink
added doc to unit tests
Browse files Browse the repository at this point in the history
with new doxygen group 'unittest'
  • Loading branch information
TysonRayJones committed Jan 15, 2020
1 parent a0ce170 commit 44ca661
Show file tree
Hide file tree
Showing 8 changed files with 356 additions and 1 deletion.
64 changes: 64 additions & 0 deletions testing/QuEST_test_calculations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ using Catch::Matchers::Contains;



/** @sa calcDensityInnerProduct
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcDensityInnerProduct", "[calculations]" ) {

Qureg mat1 = createDensityQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -100,6 +104,10 @@ TEST_CASE( "calcDensityInnerProduct", "[calculations]" ) {



/** @sa calcExpecPauliProd
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcExpecPauliProd", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -238,6 +246,10 @@ TEST_CASE( "calcExpecPauliProd", "[calculations]" ) {



/** @sa calcExpecPauliSum
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcExpecPauliSum", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -374,6 +386,10 @@ TEST_CASE( "calcExpecPauliSum", "[calculations]" ) {



/** @sa calcFidelity
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcFidelity", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -522,6 +538,10 @@ TEST_CASE( "calcFidelity", "[calculations]" ) {



/** @sa calcHilbertSchmidtDistance
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcHilbertSchmidtDistance", "[calculations]" ) {

Qureg mat1 = createDensityQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -614,6 +634,10 @@ TEST_CASE( "calcHilbertSchmidtDistance", "[calculations]" ) {



/** @sa calcInnerProduct
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcInnerProduct", "[calculations]" ) {

Qureg vec1 = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -685,6 +709,10 @@ TEST_CASE( "calcInnerProduct", "[calculations]" ) {



/** @sa calcProbOfOutcome
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcProbOfOutcome", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -804,6 +832,10 @@ TEST_CASE( "calcProbOfOutcome", "[calculations]" ) {



/** @sa calcPurity
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcPurity", "[calculations]" ) {

Qureg mat = createDensityQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -872,6 +904,10 @@ TEST_CASE( "calcPurity", "[calculations]" ) {



/** @sa calcTotalProb
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "calcTotalProb", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -935,6 +971,10 @@ TEST_CASE( "calcTotalProb", "[calculations]" ) {



/** @sa getAmp
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getAmp", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -970,6 +1010,10 @@ TEST_CASE( "getAmp", "[calculations]" ) {



/** @sa getDensityAmp
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getDensityAmp", "[calculations]" ) {

Qureg mat = createDensityQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -1009,6 +1053,10 @@ TEST_CASE( "getDensityAmp", "[calculations]" ) {



/** @sa getImagAmp
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getImagAmp", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -1043,6 +1091,10 @@ TEST_CASE( "getImagAmp", "[calculations]" ) {



/** @sa getNumAmps
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getNumAmps", "[calculations]" ) {

SECTION( "correctness" ) {
Expand All @@ -1069,6 +1121,10 @@ TEST_CASE( "getNumAmps", "[calculations]" ) {



/** @sa getNumQubits
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getNumQubits", "[calculations]" ) {

SECTION( "correctness" ) {
Expand Down Expand Up @@ -1098,6 +1154,10 @@ TEST_CASE( "getNumQubits", "[calculations]" ) {



/** @sa getProbAmp
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getProbAmp", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down Expand Up @@ -1133,6 +1193,10 @@ TEST_CASE( "getProbAmp", "[calculations]" ) {



/** @sa getRealAmp
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getRealAmp", "[calculations]" ) {

Qureg vec = createQureg(NUM_QUBITS, QUEST_ENV);
Expand Down
48 changes: 48 additions & 0 deletions testing/QuEST_test_data_structures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ using Catch::Matchers::Contains;



/** @sa fromComplex
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "fromComplex", "[data_structures]" ) {

Complex a = {.real=.5, .imag=-.2};
Expand All @@ -19,6 +23,10 @@ TEST_CASE( "fromComplex", "[data_structures]" ) {



/** @sa getStaticComplexMatrixN
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "getStaticComplexMatrixN", "[data_structures]" ) {

/* use of this function is illegal in C++ */
Expand All @@ -27,6 +35,10 @@ TEST_CASE( "getStaticComplexMatrixN", "[data_structures]" ) {



/** @sa toComplex
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "toComplex", "[data_structures]" ) {

qcomp a = .5 - .2i;
Expand All @@ -38,6 +50,10 @@ TEST_CASE( "toComplex", "[data_structures]" ) {



/** @sa createCloneQureg
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "createCloneQureg", "[data_structures]" ) {

SECTION( "state-vector" ) {
Expand Down Expand Up @@ -80,6 +96,10 @@ TEST_CASE( "createCloneQureg", "[data_structures]" ) {



/** @sa createComplexMatrixN
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "createComplexMatrixN", "[data_structures]" ) {

SECTION( "correctness" ) {
Expand All @@ -104,6 +124,10 @@ TEST_CASE( "createComplexMatrixN", "[data_structures]" ) {



/** @sa createDensityQureg
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "createDensityQureg", "[data_structures]" ) {

// must be at least one amplitude per node
Expand Down Expand Up @@ -159,6 +183,10 @@ TEST_CASE( "createDensityQureg", "[data_structures]" ) {



/** @sa createQuESTEnv
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "createQuESTEnv", "[data_structures]" ) {

/* there is no meaningful way to test this */
Expand All @@ -167,6 +195,10 @@ TEST_CASE( "createQuESTEnv", "[data_structures]" ) {



/** @sa createQureg
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "createQureg", "[data_structures]" ) {

// must be at least one amplitude per node
Expand Down Expand Up @@ -220,6 +252,10 @@ TEST_CASE( "createQureg", "[data_structures]" ) {



/** @sa destroyComplexMatrixN
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "destroyComplexMatrixN", "[data_structures]" ) {

SECTION( "correctness" ) {
Expand Down Expand Up @@ -247,6 +283,10 @@ TEST_CASE( "destroyComplexMatrixN", "[data_structures]" ) {



/** @sa destroyQuESTEnv
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "destroyQuESTEnv", "[data_structures]" ) {

/* there is no meaningful way to test this */
Expand All @@ -255,6 +295,10 @@ TEST_CASE( "destroyQuESTEnv", "[data_structures]" ) {



/** @sa destroyQureg
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "destroyQureg", "[data_structures]" ) {

/* there is no meaningful way to test this.
Expand All @@ -268,6 +312,10 @@ TEST_CASE( "destroyQureg", "[data_structures]" ) {



/** @sa initComplexMatrixN
* @ingroup unittest
* @author Tyson Jones
*/
TEST_CASE( "initComplexMatrixN", "[data_structures]" ) {

/* use of this function is illegal in C++ */
Expand Down
Loading

0 comments on commit 44ca661

Please sign in to comment.