Skip to content

Commit

Permalink
Add a test for the bug that was found with BernoulliSampler not copyi…
Browse files Browse the repository at this point in the history
…ng the complement param
  • Loading branch information
holdenk committed Apr 9, 2014
1 parent dd0b737 commit 264502a
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ class RandomSamplerSuite extends FunSuite with BeforeAndAfter with EasyMockSugar
}
}

test("BernoulliSamplerWithRangeInverse") {
expecting {
for(x <- Seq(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)) {
random.nextDouble().andReturn(x)
}
}
whenExecuting(random)
{
val sampler = new BernoulliSampler[Int](0.25, 0.55, true)(random)
assert(sampler.sample(a.iterator).toList === List(1, 2, 6, 7, 8, 9))
}
}


test("BernoulliSamplerWithRatio") {
expecting {
for(x <- Seq(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)) {
Expand Down

0 comments on commit 264502a

Please sign in to comment.