Browse code

added top level test

Tom Sherman authored on 30/04/2018 16:40:55
Showing4 changed files

... ...
@@ -1,14 +1,8 @@
1
-#include "Archive.h"
2
-#include "GapsRunner.h"
3
-#include "Random.h"
4 1
 #include "SIMD.h"
2
+#include "GapsRunner.h"
5 3
 
6 4
 #include <Rcpp.h>
7 5
 
8
-// used to convert defined macro values into strings
9
-#define STR_HELPER(x) #x
10
-#define STR(x) STR_HELPER(x)
11
-
12 6
 // [[Rcpp::export]]
13 7
 Rcpp::List cogaps_cpp(const Rcpp::NumericMatrix &D,
14 8
 const Rcpp::NumericMatrix &S, unsigned nFactor, unsigned nEquil,
... ...
@@ -36,6 +30,10 @@ unsigned nSample, const std::string &fileName, const std::string &cptFile)
36 30
     return runner.run();
37 31
 }
38 32
 
33
+// used to convert defined macro values into strings
34
+#define STR_HELPER(x) #x
35
+#define STR(x) STR_HELPER(x)
36
+
39 37
 // [[Rcpp::export]]
40 38
 std::string getBuildReport_cpp()
41 39
 {
... ...
@@ -20,9 +20,14 @@ enum GapsPhase
20 20
     GAPS_SAMP
21 21
 };
22 22
 
23
+// Manages all data and parameters for running CoGAPS; contains the high-level
24
+// algorithm logic
23 25
 class GapsRunner
24 26
 {
25 27
 private:
28
+#ifdef GAPS_INTERNAL_TESTS
29
+public:
30
+#endif
26 31
 
27 32
     Vector mChiSqEquil;
28 33
     Vector mNumAAtomsEquil;
... ...
@@ -86,4 +91,4 @@ public:
86 91
     Rcpp::List run();
87 92
 };
88 93
 
89
-#endif
90 94
\ No newline at end of file
95
+#endif // __COGAPS_GAPS_RUNNER_H__
91 96
\ No newline at end of file
... ...
@@ -12,6 +12,7 @@ OBJECTS =   Algorithms.o \
12 12
             test-runner.o \
13 13
             cpp_tests/testAlgorithms.o \
14 14
             cpp_tests/testAtomicDomain.o \
15
+            cpp_tests/testGapsRunner.o \
15 16
             cpp_tests/testGibbsSampler.o \
16 17
             cpp_tests/testMatrix.o \
17 18
             cpp_tests/testProposalQueue.o \
18 19
new file mode 100644
... ...
@@ -0,0 +1,24 @@
1
+#include "catch.h"
2
+#include "../GapsRunner.h"
3
+
4
+TEST_CASE("Test Top Level CoGAPS Call")
5
+{
6
+    Rcpp::Environment pkgEnv;
7
+    pkgEnv = Rcpp::Environment::namespace_env("CoGAPS");
8
+    Rcpp::NumericMatrix D = pkgEnv.find("SimpSim.D");
9
+    Rcpp::NumericMatrix S = pkgEnv.find("SimpSim.S");
10
+
11
+    GapsRunner runner(D, S, 3, 500, 100, 500, 0, 0, 0.01f, 0.01f, 100.f, 100.f,
12
+        123, false, false, 0, "gaps_checkpoint.out", "N",
13
+        Rcpp::NumericMatrix());
14
+    //CATCH_REQUIRE_NO_THROWS(runner.run());
15
+}
16
+
17
+#ifdef GAPS_INTERNAL_TESTS
18
+
19
+TEST_CASE("Test Individual Steps")
20
+{
21
+
22
+}
23
+
24
+#endif
0 25
\ No newline at end of file