From 1419420147bb8089bdc41b5bae46ea95d88a4515 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 4 Sep 2024 09:04:11 +0200 Subject: [PATCH] add more tests --- .../plot.p_significance/plot-p-sig-frequ1.svg | 69 ++++++++++++++++++ .../plot.p_significance/plot-p-sig-frequ2.svg | 71 ++++++++++++++++++ .../plot.p_significance/plot-p-sig-frequ3.svg | 72 +++++++++++++++++++ tests/testthat/test-plot.p_significance.R | 24 +++++++ 4 files changed, 236 insertions(+) create mode 100644 tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ1.svg create mode 100644 tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ2.svg create mode 100644 tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ3.svg diff --git a/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ1.svg b/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ1.svg new file mode 100644 index 000000000..7cbbbddc3 --- /dev/null +++ b/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ1.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +educationhigh +educationmid +age +time + + + + + + + + + + +0 +5 +10 +15 +20 +25 +Possible parameter values +Parameters +Practical Significance + + diff --git a/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ2.svg b/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ2.svg new file mode 100644 index 000000000..be25021ff --- /dev/null +++ b/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ2.svg @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +educationhigh +educationmid +age +time + + + + + + + + + + +0 +5 +10 +15 +20 +25 +Possible parameter values +Parameters +Practical Significance + + diff --git a/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ3.svg b/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ3.svg new file mode 100644 index 000000000..904c538dd --- /dev/null +++ b/tests/testthat/_snaps/plot.p_significance/plot-p-sig-frequ3.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +educationhigh +educationmid +age +time + + + + + + + + + + +0 +5 +10 +15 +20 +25 +Possible parameter values +Parameters +Practical Significance + + diff --git a/tests/testthat/test-plot.p_significance.R b/tests/testthat/test-plot.p_significance.R index bd3be9f5c..ffedce220 100644 --- a/tests/testthat/test-plot.p_significance.R +++ b/tests/testthat/test-plot.p_significance.R @@ -25,3 +25,27 @@ test_that("`plot.see_p_significance works for two thresholds", { fig = plot(out) ) }) + +test_that("`plot.see_p_significance works {parmaters}}", { + skip_if_not_installed("vdiffr") + data(qol_cancer, package = "parameters") + model <- lm(QoL ~ time + age + education, data = qol_cancer) + set.seed(123) + out <- parameters::p_significance(model) + vdiffr::expect_doppelganger( + title = "plot.p_sig_frequ1", + fig = plot(out) + ) + set.seed(123) + out <- parameters::p_significance(model, threshold = c(-0.5, 3.3)) + vdiffr::expect_doppelganger( + title = "plot.p_sig_frequ2", + fig = plot(out) + ) + set.seed(123) + out <- parameters::p_significance(model, threshold = c(-0.5, 5)) + vdiffr::expect_doppelganger( + title = "plot.p_sig_frequ3", + fig = plot(out) + ) +})