From fb9103b56fa583bb9a4370b5fa249e1eacd032c8 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 9 Apr 2020 12:40:51 +0200 Subject: Add another visual test for coverage --- test.log | 32 +++---- tests/figs/plotting/plot-res-for-focus-c.svg | 132 +++++++++++++++++++++++++++ tests/testthat/test_plots_summary_twa.R | 4 +- 3 files changed, 151 insertions(+), 17 deletions(-) create mode 100644 tests/figs/plotting/plot-res-for-focus-c.svg diff --git a/test.log b/test.log index b9d0cc74..5dae193a 100644 --- a/test.log +++ b/test.log @@ -2,34 +2,34 @@ Loading mkin Testing mkin ✔ | OK F W S | Context ✔ | 2 | Export dataset for reading into CAKE -✔ | 13 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.7 s] -✔ | 4 | Calculation of FOCUS chi2 error levels [2.3 s] -✔ | 4 | Fitting the SFORB model [1.8 s] +✔ | 13 | Results for FOCUS D established in expertise for UBA (Ranke 2014) [3.5 s] +✔ | 4 | Calculation of FOCUS chi2 error levels [2.2 s] +✔ | 4 | Fitting the SFORB model [1.7 s] ✔ | 5 | Calculation of Akaike weights -✔ | 10 | Confidence intervals and p-values [10.1 s] -✔ | 14 | Error model fitting [41.3 s] +✔ | 10 | Confidence intervals and p-values [9.5 s] +✔ | 14 | Error model fitting [38.0 s] ✔ | 6 | Test fitting the decline of metabolites from their maximum [0.8 s] ✔ | 1 | Fitting the logistic model [0.9 s] ✔ | 1 | Test dataset class mkinds used in gmkin -✔ | 12 | Special cases of mkinfit calls [2.5 s] +✔ | 12 | Special cases of mkinfit calls [2.3 s] ✔ | 9 | mkinmod model generation and printing [0.2 s] -✔ | 3 | Model predictions with mkinpredict [0.4 s] -✔ | 16 | Evaluations according to 2015 NAFTA guidance [4.3 s] -✔ | 5 | Nonlinear mixed-effects models [11.6 s] -✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.4 s] +✔ | 3 | Model predictions with mkinpredict [0.3 s] +✔ | 16 | Evaluations according to 2015 NAFTA guidance [4.1 s] +✔ | 5 | Nonlinear mixed-effects models [11.1 s] +✔ | 4 | Calculation of maximum time weighted average concentrations (TWAs) [2.3 s] ✔ | 3 | Summary -✔ | 13 | Plotting [5.1 s] +✔ | 14 | Plotting [4.8 s] ✔ | 4 | AIC calculation ✔ | 4 | Residuals extracted from mkinfit models -✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [5.6 s] +✔ | 2 | Complex test case from Schaefer et al. (2007) Piacenza paper [5.3 s] ✔ | 1 | Summaries of old mkinfit objects -✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [7.7 s] -✔ | 9 | Hypothesis tests [39.7 s] +✔ | 4 | Results for synthetic data established in expertise for UBA (Ranke 2014) [6.9 s] +✔ | 9 | Hypothesis tests [36.8 s] ══ Results ═════════════════════════════════════════════════════════════════════ -Duration: 140.8 s +Duration: 130.9 s -OK: 149 +OK: 150 Failed: 0 Warnings: 0 Skipped: 0 diff --git a/tests/figs/plotting/plot-res-for-focus-c.svg b/tests/figs/plotting/plot-res-for-focus-c.svg new file mode 100644 index 00000000..43b94055 --- /dev/null +++ b/tests/figs/plotting/plot-res-for-focus-c.svg @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + +0 +20 +40 +60 +80 +100 +120 + + + + + + +0 +20 +40 +60 +80 + + + + + + +Time +Observed + + + + + + + + + + + + + + + + + + +parent + + + + + + + + + + + + + + + + + + +0 +20 +40 +60 +80 +100 +120 + + + + + + +-10 +-5 +0 +5 +10 + + + + + + +Time +Residual + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R index de3a5fdb..3981bde7 100644 --- a/tests/testthat/test_plots_summary_twa.R +++ b/tests/testthat/test_plots_summary_twa.R @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2019 Johannes Ranke +# Copyright (C) 2016-2020 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -94,6 +94,7 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", { skip_on_cran() plot_default_FOCUS_C_SFO <- function() plot(fits[["SFO", "FOCUS_C"]]) plot_res_FOCUS_C_SFO <- function() plot(fits[["SFO", "FOCUS_C"]], show_residuals = TRUE) + plot_res_FOCUS_C_SFO_2 <- function() plot_res(fits[["SFO", "FOCUS_C"]]) plot_sep_FOCUS_C_SFO <- function() plot_sep(fits[["SFO", "FOCUS_C"]]) mkinparplot_FOCUS_C_SFO <- function() mkinparplot(fits[["SFO", "FOCUS_C"]]) mkinerrplot_FOCUS_C_SFO <- function() mkinerrplot(fits[["SFO", "FOCUS_C"]]) @@ -112,6 +113,7 @@ test_that("Plotting mkinfit and mmkin objects is reproducible", { vdiffr::expect_doppelganger("mkinfit plot for FOCUS C with defaults", plot_default_FOCUS_C_SFO) vdiffr::expect_doppelganger("mkinfit plot for FOCUS C with residuals like in gmkin", plot_res_FOCUS_C_SFO) + vdiffr::expect_doppelganger("plot_res for FOCUS C", plot_res_FOCUS_C_SFO_2) 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) vdiffr::expect_doppelganger("mkinerrplot for FOCUS C SFO", mkinerrplot_FOCUS_C_SFO) -- cgit v1.2.1