Browse Source

Add more test data files.

tags/version/0.1.4^0
Kai Kretschmann 6 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) {
}
string filename = argv[1];

MeasureEntropy m(filename);
m.measure();
m.printResult();

MeasureBase* mb = new MeasureEntropy(filename);
mb->measure();
mb->printResult();
delete mb;

shared_ptr<MeasureBase> sp(new MeasureEntropy(filename));
sp->measure();
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) {
ASSERT_NEAR(r, 2.9, 0.1);
}

TEST(MeasureEntropyTest, CalculateZeroes) {
jastacry::MeasureEntropy m("data/zeroes.dat");
m.measure();
double r = m.getResult();
ASSERT_DOUBLE_EQ(r, 0.0);
}

TEST(MeasureEntropyTest, CalculateRandom) {
jastacry::MeasureEntropy m("data/random.dat");
m.measure();
double r = m.getResult();
ASSERT_NEAR(r, 7.8, 0.2);
}


int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);

Loading…
Cancel
Save
Social stuff:
Mastodon