aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-10-22 10:13:16 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-10-22 10:13:16 +0200
commitf8d45402477a588f773f6fd300f3d4e914648773 (patch)
treeb4191dab6d7249150933e322349501d90dc05ac3 /tests/testthat
parent1c8fae503c6c18764d62bc98236111168ac83529 (diff)
Improved visual testing
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/FOCUS_2006_D.csf2
-rw-r--r--tests/testthat/setup_script.R2
-rw-r--r--tests/testthat/test_error_models.R6
-rw-r--r--tests/testthat/test_plots_summary_twa.R4
4 files changed, 7 insertions, 7 deletions
diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf
index 171abbb0..638acd88 100644
--- a/tests/testthat/FOCUS_2006_D.csf
+++ b/tests/testthat/FOCUS_2006_D.csf
@@ -5,7 +5,7 @@ Description:
MeasurementUnits: % AR
TimeUnits: days
Comments: Created using mkin::CAKE_export
-Date: 2019-10-21
+Date: 2019-10-22
Optimiser: IRLS
[Data]
diff --git a/tests/testthat/setup_script.R b/tests/testthat/setup_script.R
index d8d94d4b..51fea4f6 100644
--- a/tests/testthat/setup_script.R
+++ b/tests/testthat/setup_script.R
@@ -76,3 +76,5 @@ f_SFO_lin_mkin_OLS <- mkinfit(m_synth_SFO_lin, SFO_lin_a, quiet = TRUE)
f_SFO_lin_mkin_ML <- mkinfit(m_synth_SFO_lin, SFO_lin_a, quiet = TRUE,
error_model = "const", error_model_algorithm = "direct")
+fit_obs_1 <- mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "obs", quiet = TRUE)
+fit_tc_1 <- mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "tc", quiet = TRUE)
diff --git a/tests/testthat/test_error_models.R b/tests/testthat/test_error_models.R
index d8263c95..12a8b7e5 100644
--- a/tests/testthat/test_error_models.R
+++ b/tests/testthat/test_error_models.R
@@ -20,18 +20,12 @@ context("Error model fitting")
test_that("Error model 'obs' works", {
skip_on_cran()
- fit_obs_1 <- mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "obs", quiet = TRUE)
parms_2 <- round(fit_obs_1$bparms.optim, c(1, 4, 4, 4, 4, 4))
expect_equivalent(parms_2, c(102.1, 0.7389, 0.2982, 0.0203, 0.7677, 0.7246))
- plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE)
-
- skip_on_travis() # This fails on Travis for an unknown reason
- vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a", plot_errmod_fit_obs_1)
})
test_that("Error model 'tc' works", {
skip_on_cran()
- fit_tc_1 <- mkinfit(m_synth_SFO_lin, SFO_lin_a, error_model = "tc", quiet = TRUE)
parms_3 <- round(fit_tc_1$bparms.optim, c(1, 4, 4, 4, 4, 4))
expect_equivalent(parms_3, c(102.1, 0.7393, 0.2992, 0.0202, 0.7687, 0.7229))
})
diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R
index 089290f6..e3ecbbc4 100644
--- a/tests/testthat/test_plots_summary_twa.R
+++ b/tests/testthat/test_plots_summary_twa.R
@@ -99,6 +99,8 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", {
mmkin_SFO <- function() plot(fits["SFO",])
plot_res_sfo_sfo <- function() plot_res(f_sfo_sfo_desolve)
plot_err_sfo_sfo <- function() plot_err(f_sfo_sfo_desolve)
+ plot_errmod_fit_obs_1 <- function() plot_err(fit_obs_1, sep_obs = FALSE)
+ plot_errmod_fit_tc_1 <- function() plot_err(fit_tc_1, sep_obs = FALSE)
vdiffr::expect_doppelganger("mkinfit plot for FOCUS C with sep = TRUE", plot_sep_FOCUS_C_SFO)
vdiffr::expect_doppelganger("mkinparplot for FOCUS C SFO", mkinparplot_FOCUS_C_SFO)
@@ -107,6 +109,8 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", {
vdiffr::expect_doppelganger("mmkin plot for SFO (FOCUS C and D)", mmkin_SFO)
vdiffr::expect_doppelganger("plot_res for FOCUS D", plot_res_sfo_sfo)
vdiffr::expect_doppelganger("plot_err for FOCUS D", plot_err_sfo_sfo)
+ vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_obs", plot_errmod_fit_obs_1)
+ vdiffr::expect_doppelganger("plot_errmod with SFO_lin_a_tc", plot_errmod_fit_tc_1)
})
context("AIC calculation")

Contact - Imprint