Skip to content

Commit aa1a375

Browse files
committed
test for a scenario including a ghost pop
1 parent 4fe17ac commit aa1a375

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

R-pkg/tests/testthat/test-21_historical_model.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,18 @@ test_that("parse_scenario", {
282282
)
283283
)
284284

285+
# scenario with ghost pop
286+
text <- str_c(
287+
"N1 N2 N3 Nbc3",
288+
"0 sample 1",
289+
"50 sample 2",
290+
"0 sample 3",
291+
"t3-DB3 VarNe 3 NF3",
292+
"t3 merge 4 3",
293+
"t3lb merge 1 4",
294+
"t2 merge 1 2",
295+
sep = "\n"
296+
)
297+
out <- parse_scenario(text)
298+
expect_true(out$valid)
285299
})

R-pkg/tests/testthat/test-22_historical_model_display.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,4 +856,20 @@ test_that("display_hist_model", {
856856
parsed_scenario <- parse_scenario(text)
857857
data2plot <- prepare_hist_model_display(parsed_scenario, grid_unit)
858858
g1 <- display_hist_model(data2plot)
859+
860+
# scenario with ghost pop
861+
text <- str_c(
862+
"N1 N2 N3 Nbc3",
863+
"0 sample 1",
864+
"50 sample 2",
865+
"0 sample 3",
866+
"t3-DB3 VarNe 3 NF3",
867+
"t3 merge 4 3",
868+
"t3lb merge 1 4",
869+
"t2 merge 1 2",
870+
sep = "\n"
871+
)
872+
parsed_scenario <- parse_scenario(text)
873+
data2plot <- prepare_hist_model_display(parsed_scenario, grid_unit)
874+
g1 <- display_hist_model(data2plot)
859875
})

0 commit comments

Comments
 (0)