From 0880c495ca96babb542a4850d1f46b43d4cb2462 Mon Sep 17 00:00:00 2001 From: "alex.hill@gmail.com" Date: Thu, 7 Nov 2024 16:24:21 +0000 Subject: [PATCH] update tests --- tests/testthat/test-convert-log-scale.R | 12 ++++++------ tests/testthat/test-plots.R | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-convert-log-scale.R b/tests/testthat/test-convert-log-scale.R index 80a88d4..76ad408 100644 --- a/tests/testthat/test-convert-log-scale.R +++ b/tests/testthat/test-convert-log-scale.R @@ -1,7 +1,7 @@ test_that("Can convert to and from log scale in R", { inputs <- data.table::fread(test_path("testdata", "testdata.csv")) - log_inputs <- convert_log2_scale(inputs, "me", lower_detection_limit = 2) - unlog_inputs <- convert_log2_scale_inverse(log_inputs, "me", lower_detection_limit = 2) + log_inputs <- convert_log2_scale(inputs, "me", smallest_value = 2) + unlog_inputs <- convert_log2_scale_inverse(log_inputs, "me", smallest_value = 2) expect_equal(inputs, unlog_inputs) }) @@ -11,7 +11,7 @@ test_that("Can convert from log scale in R", { res <- convert_log2_scale_inverse( inputs, vars_to_transform = c("me", "lo"), - lower_detection_limit = 5) + smallest_value = 5) expect_equal(res$me, 5 * 2^inputs$me) expect_equal(res$lo, 5 * 2^inputs$lo) @@ -22,7 +22,7 @@ test_that("Can convert from log scale in R", { res <- convert_log2_scale_inverse( inputs, vars_to_transform = "me", - lower_detection_limit = 10) + smallest_value = 10) expect_equal(res$me, 10 * 2^inputs$me) }) @@ -32,7 +32,7 @@ test_that("Can convert from log scale in Cpp", { rescpp <- convert_log2_scale_inverse_cpp( inputs, vars_to_transform = c("me", "lo"), - lower_detection_limit = 5) + smallest_value = 5) expect_equal(rescpp$me, 5 * 2^(inputs$me)) expect_equal(rescpp$lo, 5 * 2^(inputs$lo)) @@ -43,7 +43,7 @@ test_that("Can convert from log scale in Cpp", { res <- convert_log2_scale_inverse_cpp( inputs, vars_to_transform = "me", - lower_detection_limit = 10) + smallest_value = 10) expect_equal(res$me, 10 * 2^inputs$me) }) diff --git a/tests/testthat/test-plots.R b/tests/testthat/test-plots.R index 9fd647d..d289912 100644 --- a/tests/testthat/test-plots.R +++ b/tests/testthat/test-plots.R @@ -24,7 +24,7 @@ test_that("Can plot prior predictions from model", { set.seed(1) plot <- mod$plot_prior_predictive(tmax = 400, n_draws = 500) expect_equal(nrow(plot$data), 400) - expect_equal(length(plot$layers), 3) + expect_equal(length(plot$layers), 7) # includes detection limits }) test_that("Prior predictions from model are the same", {