From e6f9e9ca89e35e610d9895b979f1351a47451db0 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 29 May 2020 16:05:11 +0200 Subject: Improve handling of warnings, reorganize tests --- tests/testthat/test_AIC.R | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/testthat/test_AIC.R (limited to 'tests/testthat/test_AIC.R') diff --git a/tests/testthat/test_AIC.R b/tests/testthat/test_AIC.R new file mode 100644 index 00000000..e9698f7c --- /dev/null +++ b/tests/testthat/test_AIC.R @@ -0,0 +1,12 @@ +context("AIC calculation") + +test_that("The AIC is reproducible", { + expect_equivalent(AIC(fits[["SFO", "FOCUS_C"]]), 59.3, scale = 1, tolerance = 0.1) + expect_equivalent(AIC(fits[, "FOCUS_C"]), + data.frame(df = c(3, 4, 5, 5), AIC = c(59.3, 44.7, 29.0, 39.2)), + scale = 1, tolerance = 0.1) + expect_error(AIC(fits["SFO", ]), "column object") + expect_equivalent(BIC(fits[, "FOCUS_C"]), + data.frame(df = c(3, 4, 5, 5), AIC = c(59.9, 45.5, 30.0, 40.2)), + scale = 1, tolerance = 0.1) +}) -- cgit v1.2.1