From 587662437bce06ea202551048226b86cff0db187 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 14 Sep 2018 21:02:46 +0200 Subject: Skip more tests on CRAN Static documentation rebuilt by pkgdown --- tests/testthat/test_FOCUS_D_UBA_expertise.R | 70 ++++++++++------------- tests/testthat/test_mkinpredict_SFO_SFO.R | 4 +- tests/testthat/test_parent_only.R | 3 + tests/testthat/test_synthetic_data_for_UBA_2014.R | 1 + tests/testthat/test_twa.R | 8 ++- 5 files changed, 40 insertions(+), 46 deletions(-) (limited to 'tests') diff --git a/tests/testthat/test_FOCUS_D_UBA_expertise.R b/tests/testthat/test_FOCUS_D_UBA_expertise.R index 5d5a801a..3b241aa4 100644 --- a/tests/testthat/test_FOCUS_D_UBA_expertise.R +++ b/tests/testthat/test_FOCUS_D_UBA_expertise.R @@ -1,4 +1,4 @@ -# Copyright (C) 2015 Johannes Ranke +# Copyright (C) 2015,2018 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin @@ -18,69 +18,59 @@ context("Results for FOCUS D established in expertise for UBA (Ranke 2014)") -SFO_SFO <- mkinmod(parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO"), quiet = TRUE) -SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"), - m1 = list(type = "SFO"), - use_of_ff = "max", quiet = TRUE) +# Results are from p. 40 -fit.default <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) -fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE) +test_that("Fits without formation fractions are correct for FOCUS D", { + SFO_SFO <- mkinmod(parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"), quiet = TRUE) + fit.default <- mkinfit(SFO_SFO, FOCUS_2006_D, quiet = TRUE) -# Results are from p. 40 + expect_equal(round(as.numeric(endpoints(fit.default)$distimes["parent", ]), 2), + c(7.02, 23.33)) + expect_equal(round(as.numeric(endpoints(fit.default)$distimes["m1", ]), 1), + c(131.8, 437.7)) -test_that("Fitted parameters are correct for FOCUS D", { + expect_equal(signif(summary(fit.default)$bpar[, "t value"], 5), + c(parent_0 = 61.720, k_parent_sink = 12.777, k_parent_m1 = 24.248, k_m1_sink = 7.3486)) +}) + +test_that("Fits with formation fractions are correct for FOCUS D", { + skip_on_cran() + SFO_SFO.ff <- mkinmod(parent = list(type = "SFO", to = "m1"), + m1 = list(type = "SFO"), + use_of_ff = "max", quiet = TRUE) + + fit.ff <- mkinfit(SFO_SFO.ff, FOCUS_2006_D, quiet = TRUE) expect_equivalent(round(fit.ff$bparms.optim, c(2, 4, 4, 4)), c(99.60, 0.0987, 0.0053, 0.5145)) -}) -test_that("FOCUS chi2 error levels are correct for FOCUS D", { expect_equivalent(round(100 * mkinerrmin(fit.ff)$err.min, 2), c(6.40, 6.46, 4.69)) -}) -test_that("DT50/90 are correct for FOCUS D when using formation fractions", { expect_equal(round(as.numeric(endpoints(fit.ff)$distimes["parent", ]), 2), c(7.02, 23.33)) expect_equal(round(as.numeric(endpoints(fit.ff)$distimes["m1", ]), 1), c(131.8, 437.7)) }) -test_that("DT50/90 are correct for FOCUS D when not using formation fractions", { - expect_equal(round(as.numeric(endpoints(fit.default)$distimes["parent", ]), 2), - c(7.02, 23.33)) - expect_equal(round(as.numeric(endpoints(fit.default)$distimes["m1", ]), 1), - c(131.8, 437.7)) -}) - # References: # Ranke (2014) Prüfung und Validierung von Modellierungssoftware als Alternative # zu ModelMaker 4.0, Umweltbundesamt Projektnummer 27452 -context("The t-test for significant difference from zero") - -test_that("The t-value for fits using internal transformations corresponds with result from FME", { - - expect_equal(signif(summary(fit.default)$bpar[, "t value"], 5), - c(parent_0 = 61.720, k_parent_sink = 12.777, k_parent_m1 = 24.248, k_m1_sink = 7.3486)) - -}) - -m_synth_DFOP_par.minff <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), - M1 = mkinsub("SFO"), - M2 = mkinsub("SFO"), - use_of_ff = "min", quiet = TRUE) - -fit_DFOP_par_c_2 <- mkinfit(m_synth_DFOP_par.minff, - synthetic_data_for_UBA_2014[[12]]$data, - quiet = TRUE) - test_that("The t-value for fits using internal transformations corresponds with results from FME, synthetic data", { + skip_on_cran() + m_synth_DFOP_par.minff <- mkinmod(parent = mkinsub("DFOP", c("M1", "M2")), + M1 = mkinsub("SFO"), + M2 = mkinsub("SFO"), + use_of_ff = "min", quiet = TRUE) + + fit_DFOP_par_c_2 <- mkinfit(m_synth_DFOP_par.minff, + synthetic_data_for_UBA_2014[[12]]$data, + quiet = TRUE) # Note that the k1 and k2 are exchanged in the untransformed fit evaluated with FME for this test expect_equal(signif(summary(fit_DFOP_par_c_2)$bpar[1:7, "t value"], 5), c(parent_0 = 80.054, k_M1_sink = 12.291, k_M2_sink = 10.588, f_parent_to_M1 = 21.4960, f_parent_to_M2 = 24.0890, k1 = 16.1450, k2 = 8.1747)) - }) diff --git a/tests/testthat/test_mkinpredict_SFO_SFO.R b/tests/testthat/test_mkinpredict_SFO_SFO.R index b7004f64..3fcdb3a2 100644 --- a/tests/testthat/test_mkinpredict_SFO_SFO.R +++ b/tests/testthat/test_mkinpredict_SFO_SFO.R @@ -1,6 +1,4 @@ -# $Id: jranke $ - -# Copyright (C) 2012-2015 Johannes Ranke +# Copyright (C) 2012-2015,2018 Johannes Ranke # Contact: jranke@uni-bremen.de # This file is part of the R package mkin diff --git a/tests/testthat/test_parent_only.R b/tests/testthat/test_parent_only.R index ee0cc144..7521e145 100644 --- a/tests/testthat/test_parent_only.R +++ b/tests/testthat/test_parent_only.R @@ -165,6 +165,7 @@ test_that("Fits for FOCUS C deviate less than 0.1% from median of values from FO }) test_that("SFO fits give approximately (0.001%) equal results with different solution methods", { + skip_on_cran() fit.A.SFO.default <- mkinfit("SFO", FOCUS_2006_A, quiet = TRUE)$bparms.optim fits.A.SFO <- list() @@ -179,6 +180,7 @@ test_that("SFO fits give approximately (0.001%) equal results with different sol }) test_that("FOMC fits give approximately (0.001%) equal results with different solution methods", { + skip_on_cran() fit.C.FOMC.default <- mkinfit("FOMC", FOCUS_2006_C, quiet = TRUE)$bparms.optim fits.C.FOMC <- list() @@ -191,6 +193,7 @@ test_that("FOMC fits give approximately (0.001%) equal results with different so }) test_that("DFOP fits give approximately (0.001%) equal results with different solution methods", { + skip_on_cran() fit.C.DFOP.default <- mkinfit("DFOP", FOCUS_2006_C, quiet = TRUE)$bparms.optim fits.C.DFOP <- list() diff --git a/tests/testthat/test_synthetic_data_for_UBA_2014.R b/tests/testthat/test_synthetic_data_for_UBA_2014.R index fd3e8bba..6856a9a3 100644 --- a/tests/testthat/test_synthetic_data_for_UBA_2014.R +++ b/tests/testthat/test_synthetic_data_for_UBA_2014.R @@ -20,6 +20,7 @@ context("Results for synthetic data established in expertise for UBA (Ranke 2014 test_that("Results are correct for SFO_lin_a", { + skip_on_cran() m_synth_SFO_lin <- mkinmod(parent = mkinsub("SFO", "M1"), M1 = mkinsub("SFO", "M2"), M2 = mkinsub("SFO"), diff --git a/tests/testthat/test_twa.R b/tests/testthat/test_twa.R index d5c0b98b..a84b2c4e 100644 --- a/tests/testthat/test_twa.R +++ b/tests/testthat/test_twa.R @@ -18,11 +18,13 @@ context("Calculation of maximum time weighted average concentrations (TWAs)") -twa_models <- c("SFO", "FOMC", "DFOP") -fits <- mmkin(twa_models, list(FOCUS_D = FOCUS_2006_D), - quiet = TRUE, cores = 1) test_that("Time weighted average concentrations are correct", { + skip_on_cran() + twa_models <- c("SFO", "FOMC", "DFOP") + fits <- mmkin(twa_models, list(FOCUS_D = FOCUS_2006_D), + quiet = TRUE, cores = 1) + outtimes_7 <- seq(0, 7, length.out = 10000) for (model in twa_models) { fit <- fits[[model, 1]] -- cgit v1.2.1