Skip to content

Commit d722aa2

Browse files
committed
add test for plotting yield curve #58
openjournals/joss-reviews#3888
1 parent 13e25b5 commit d722aa2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Test the plot_yield_curve function
2+
test_that("Yield curve function returns a ggplot object",
3+
{
4+
p1 <- plot_yield_curve(
5+
lh.params = list(
6+
S0 = 0.944, S1plus = 0.99, AgeMat = 17,
7+
nages = 19, lambdaMax = 1.02, K1plus = 9000
8+
),
9+
MNPL_in = 0.5, z = NA, lang = "en"
10+
)
11+
expect_true(ggplot2::is.ggplot(p1))
12+
})
13+
14+
test_that("Yield curve function returns a ggplot object when z is provided",
15+
{
16+
p2 <- plot_yield_curve(
17+
lh.params = list(
18+
S0 = 0.944, S1plus = 0.99, AgeMat = 17,
19+
nages = 19, lambdaMax = 1.02, K1plus = 9000
20+
),
21+
MNPL_in = 0.5, z = 2.30, lang = "en"
22+
)
23+
expect_true(ggplot2::is.ggplot(p2))
24+
})

0 commit comments

Comments
 (0)