Skip to content

Commit

Permalink
add test for edge case in #37
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHohmann committed Aug 28, 2024
1 parent 8ad7508 commit eb35285
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/testthat/test_get_height.adm.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ test_that("Assignement of values outside of domain are correct", {
expect_true(is.na(get_height( adm, t = min(t) - 1, out_dom_val_h = "default")))
expect_equal(get_height( adm, t = max(t) + 1, out_dom_val_h = "strat_limits"), max(adm$h))
expect_equal(get_height( adm, t = min(t) - 1, out_dom_val_h = "strat_limits"), min(adm$h))
})
})


8 changes: 8 additions & 0 deletions tests/testthat/test_get_time.adm.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,13 @@ test_that("Hiatuses at start/end of adm are treated correctly", {
expect_true(is.na(get_time(adm, 3, hiat_mode = "end", bdry_pts_hiat = "destructive")))
})

test_that("values above hiatuses are correct",{
t = 1:5
h = c(2,3,3,4,5)
adm = tp_to_adm(t, h)
t_eval = 3.1
h_ev = get_height(adm, t_eval)
expect_equal(get_time(adm, h_ev), t_eval)
})


0 comments on commit eb35285

Please sign in to comment.