From 6b4ab746e5474dfeda9237f01bc2dd01f1bb62ee Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 27 Feb 2019 12:04:52 +0100 Subject: Increase test coverage --- tests/testthat/test_from_max_mean.R | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/testthat/test_from_max_mean.R (limited to 'tests/testthat/test_from_max_mean.R') diff --git a/tests/testthat/test_from_max_mean.R b/tests/testthat/test_from_max_mean.R new file mode 100644 index 00000000..8e5953b9 --- /dev/null +++ b/tests/testthat/test_from_max_mean.R @@ -0,0 +1,17 @@ +context("Test fitting the decline of metabolites from their maximum") + +test_that("Fitting from maximum mean value works", { + SFO_SFO <- mkinmod(parent = mkinsub("SFO", "m1"), + m1 = mkinsub("SFO")) + expect_error(mkinfit(SFO_SFO, FOCUS_2006_D, from_max_mean = TRUE)) + + # We can either explicitly create a model for m1, or subset the data + SFO_m1 <- mkinmod(m1 = mkinsub("SFO")) + f.1 <- mkinfit(SFO_m1, FOCUS_2006_D, from_max_mean = TRUE, quiet = TRUE) + expect_equivalent(endpoints(f.1)$distimes["m1", ], c(170.8, 567.5), + scale = 1, tolerance = 0.1) + + f.2 <- mkinfit("SFO", subset(FOCUS_2006_D, name == "m1"), from_max_mean = TRUE, quiet = TRUE) + expect_equivalent(endpoints(f.2)$distimes["m1", ], c(170.8, 567.5), + scale = 1, tolerance = 0.1) +}) -- cgit v1.2.1