Browse Source

Add more test data files.

tags/version/0.1.4^0
Kai Kretschmann 3 months ago
parent
commit
ceaeed6e29
4 changed files with 14 additions and 9 deletions
  1. 0
    9
      JCmeasure.cpp
  2. BIN
      data/random.dat
  3. BIN
      data/zeroes.dat
  4. 14
    0
      tests.cpp

+ 0
- 9
JCmeasure.cpp View File

@@ -17,15 +17,6 @@ int main(int argc, char **argv) {
17 17
 	}
18 18
 	string filename = argv[1];
19 19
 
20
-	MeasureEntropy m(filename);
21
-	m.measure();
22
-	m.printResult();
23
-
24
-	MeasureBase* mb = new MeasureEntropy(filename);
25
-	mb->measure();
26
-	mb->printResult();
27
-	delete mb;
28
-
29 20
 	shared_ptr<MeasureBase> sp(new MeasureEntropy(filename));
30 21
 	sp->measure();
31 22
 	sp->printResult();

BIN
data/random.dat View File


BIN
data/zeroes.dat View File


+ 14
- 0
tests.cpp View File

@@ -16,6 +16,20 @@ TEST(MeasureEntropyTest, Calculate) {
16 16
 	ASSERT_NEAR(r, 2.9, 0.1);
17 17
 }
18 18
 
19
+TEST(MeasureEntropyTest, CalculateZeroes) {
20
+	jastacry::MeasureEntropy m("data/zeroes.dat");
21
+	m.measure();
22
+	double r = m.getResult();
23
+	ASSERT_DOUBLE_EQ(r, 0.0);
24
+}
25
+
26
+TEST(MeasureEntropyTest, CalculateRandom) {
27
+	jastacry::MeasureEntropy m("data/random.dat");
28
+	m.measure();
29
+	double r = m.getResult();
30
+	ASSERT_NEAR(r, 7.8, 0.2);
31
+}
32
+
19 33
 
20 34
 int main(int argc, char **argv) {
21 35
     testing::InitGoogleTest(&argc, argv);

Loading…
Cancel
Save
Social stuff:
Mastodon