Skip to content

Commit

Permalink
added simple sampling test
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobaustin123 committed Apr 18, 2020
1 parent a371f33 commit 04bd73f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/distribution/uniform_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,15 @@ TEST_F(uniform_dist_fixture, simple_uniform) {
EXPECT_DOUBLE_EQ(dist3.pdf(0.25), 2.5);
}

TEST_F(uniform_dist_fixture, uniform_sampling) {
std::random_device rd{};
std::mt19937 gen{rd()};

for (int i = 0; i < 100; i++) {
double sample = dist1.sample(gen);
EXPECT_GT(sample, 0.0);
EXPECT_LT(sample, 1.0);
}
}

} // ppl

0 comments on commit 04bd73f

Please sign in to comment.