diff --git a/tests/testthat/test-admiral_options.R b/tests/testthat/test-admiral_options.R index 241459d9a0..c89050f158 100644 --- a/tests/testthat/test-admiral_options.R +++ b/tests/testthat/test-admiral_options.R @@ -18,7 +18,7 @@ test_that("get_admiral_option Test 3: non-character argument triggers assertion }) # set_admiral_options ---- -## Test 4: set works ---- +## Test 4: set subject_keys works ---- test_that("set_admiral_options Test 4: set works", { set_admiral_options(subject_keys = exprs(STUDYID, USUBJID2)) expect_equal(get_admiral_option("subject_keys"), exprs(STUDYID, USUBJID2)) @@ -35,4 +35,26 @@ test_that("set_admiral_options Test 5: unexpected function input for set gives e class = "assert-admiraldev" ) }) + +## Test 6: non-positive numeric argument triggers assertion error ---- +test_that("get_admiral_option Test 6: non-positive numeric argument triggers assertion error", { + sigfigs <- 0 + expect_error( + set_admiral_options(signif_digits = sigfigs), + class = "assert_integer_scalar" + ) + sigfigs <- -1 + expect_error( + set_admiral_options(signif_digits = sigfigs), + class = "assert_integer_scalar" + ) +}) + +## Test 7: set signif_digits works ---- +test_that("set_admiral_options Test 7: set works", { + sigfigs <- get_admiral_option("signif_digits") + set_admiral_options(signif_digits = sigfigs + 1) + expect_equal(get_admiral_option("signif_digits"), sigfigs + 1) + set_admiral_options(signif_digits = sigfigs) +}) set_admiral_options(subject_keys = exprs(STUDYID, USUBJID))