Skip to content

Commit 18391e6

Browse files
committed
Added new test
1 parent 9cae463 commit 18391e6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
test_that("pFinalSizeAndGen() matches brute-force calculation", {
2+
pfs1 <- pFinalSizeAndGen(g=1, n=1, j=4, R=1.2, k=0.33)
3+
pfs2 <- pFinalSizeAndGen(g=2, n=1, j=4, R=1.2, k=0.33)
4+
pfs3 <- pFinalSizeAndGen(g=3, n=1, j=4, R=1.2, k=0.33)
5+
6+
d <- dnbinom(0:3, mu=1.2, size=0.33)
7+
dnb1 <- d[4] * d[1]^3
8+
dnb2 <- d[3] * d[2] * d[1]^2 * 2 +
9+
d[2] * d[3] * d[1]^2
10+
dnb3 <- d[2]^3 * d[1]
11+
12+
expect_equal(pfs1, dnb1, tolerance = sqrt(.Machine$double.eps))
13+
expect_equal(pfs2, dnb2, tolerance = sqrt(.Machine$double.eps))
14+
expect_equal(pfs3, dnb3, tolerance = sqrt(.Machine$double.eps))
15+
})

0 commit comments

Comments
 (0)