Skip to content

Commit 13e25b5

Browse files
committed
add test for get_mnpl and calc_z #58 openjournals/joss-reviews#3888
1 parent 31d038f commit 13e25b5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/testthat/test-get_mnpl.R

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# test get_mnpl() function
2+
test_that("MNPL should be higher when lambdaMax is higher", {
3+
aa <- get_mnpl(
4+
E.start = 0.001,
5+
lh.params = list(
6+
S0 = 0.944, S1plus = 0.99, AgeMat = 17, nages = 19,
7+
z = 2.39, lambdaMax = 1.04,
8+
K1plus = 9000
9+
)
10+
)
11+
bb <- get_mnpl(
12+
E.start = 0.001,
13+
lh.params = list(
14+
S0 = 0.944, S1plus = 0.99, AgeMat = 17, nages = 19,
15+
z = 2.39, lambdaMax = 1.12,
16+
K1plus = 9000
17+
)
18+
)
19+
expect_true(aa < bb)
20+
})
21+
22+
test_that("MNPL and z should be convertible", {
23+
z_in <- 2.39
24+
cc <- get_mnpl(
25+
E.start = 0.001,
26+
lh.params = list(
27+
S0 = 0.944, S1plus = 0.99, AgeMat = 17, nages = 19,
28+
z = z_in, lambdaMax = 1.04,
29+
K1plus = 9000
30+
)
31+
)
32+
dd <- calc_z(MNPL_in = cc, lh.params_in = list(
33+
S0 = 0.944, S1plus = 0.99, AgeMat = 17, nages = 19,
34+
lambdaMax = 1.04,
35+
K1plus = 9000
36+
))
37+
expect_equal(z_in, dd)
38+
})

0 commit comments

Comments
 (0)