aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-11-18 10:09:28 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2022-11-18 11:31:49 +0100
commita14237fc1580b09f8772cd3330b0a445785e48ac (patch)
treebd49df2949991e9f53caeb47dba7f8cb1a661615 /tests/testthat
parent76deb3739d563068ccd4637afa8933d6ddbc70ef (diff)
Round parameters with signif() before printing
This will hopefully make the test pass on all relevant platforms.
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/print_dfop_saemix_1.txt8
-rw-r--r--tests/testthat/test_mixed.R7
2 files changed, 10 insertions, 5 deletions
diff --git a/tests/testthat/print_dfop_saemix_1.txt b/tests/testthat/print_dfop_saemix_1.txt
index bdc40065..1d399a52 100644
--- a/tests/testthat/print_dfop_saemix_1.txt
+++ b/tests/testthat/print_dfop_saemix_1.txt
@@ -13,11 +13,11 @@ Likelihood computed by importance sampling
Fitted parameters:
estimate lower upper
-parent_0 99.92 98.77 101.06
-log_k1 -2.72 -2.95 -2.50
-log_k2 -4.14 -4.27 -4.01
+parent_0 100.00 99.00 100.00
+log_k1 -2.70 -3.00 -2.50
+log_k2 -4.10 -4.30 -4.00
g_qlogis -0.35 -0.53 -0.16
-a.1 0.92 0.68 1.16
+a.1 0.92 0.68 1.20
b.1 0.05 0.04 0.06
SD.log_k1 0.37 0.23 0.51
SD.log_k2 0.23 0.14 0.31
diff --git a/tests/testthat/test_mixed.R b/tests/testthat/test_mixed.R
index 646b6110..2d53c6dd 100644
--- a/tests/testthat/test_mixed.R
+++ b/tests/testthat/test_mixed.R
@@ -11,7 +11,12 @@ test_that("Print methods work", {
expect_known_output(print(mixed(mmkin_sfo_1), digits = 2), "print_mmkin_sfo_1_mixed.txt")
expect_known_output(print(dfop_nlme_1, digits = 1), "print_dfop_nlme_1.txt")
- expect_known_output(print(dfop_saemix_1, digits = 1), "print_dfop_saemix_1.txt")
+ # In order to address the platform dependence of the results, we round to two
+ # significant digits before printing
+ dfop_saemix_1_print <- dfop_saemix_1
+ dfop_saemix_1_print$so@results@conf.int[c("estimate", "lower", "upper")] <-
+ signif(dfop_saemix_1_print$so@results@conf.int[c("estimate", "lower", "upper")], 2)
+ expect_known_output(print(dfop_saemix_1_print, digits = 1), "print_dfop_saemix_1.txt")
})
test_that("nlme results are reproducible to some degree", {

Contact - Imprint