From 2b60c505374ebaa36ad2abdc8a7396d3cceb848a Mon Sep 17 00:00:00 2001 From: jimrothstein Date: Thu, 19 Dec 2024 18:51:52 -0800 Subject: [PATCH 1/3] # 2581 enhance test coverage: derive_var_trtemfl() - Test # 10, fix typo - Test # 11, new test to increase coverage --- admiral.Rproj | 1 + tests/testthat/_snaps/compute_scale.md | 2 +- tests/testthat/_snaps/derive_var_trtemfl.md | 9 +++++++++ tests/testthat/test-derive_var_trtemfl.R | 14 +++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/admiral.Rproj b/admiral.Rproj index 576c7085e4..cdb9238896 100644 --- a/admiral.Rproj +++ b/admiral.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 07f3544c-317e-4fa8-ba3b-310457396203 RestoreWorkspace: No SaveWorkspace: No diff --git a/tests/testthat/_snaps/compute_scale.md b/tests/testthat/_snaps/compute_scale.md index a95fd8c969..b7bc57c65d 100644 --- a/tests/testthat/_snaps/compute_scale.md +++ b/tests/testthat/_snaps/compute_scale.md @@ -7,7 +7,7 @@ ! Argument `target_range` is missing with no default and `source_range` is not missing. i Either both or neither arguments should be specified. ---- +# compute_scale Test 7: error if target_range is supplied, but not source_range Code compute_scale(input, target_range = c(0, 100), min_n = 2) diff --git a/tests/testthat/_snaps/derive_var_trtemfl.md b/tests/testthat/_snaps/derive_var_trtemfl.md index 2c3c488096..607f736f26 100644 --- a/tests/testthat/_snaps/derive_var_trtemfl.md +++ b/tests/testthat/_snaps/derive_var_trtemfl.md @@ -34,3 +34,12 @@ ! `intensity` argument was specified but not `initial_intensity` Either both or none of them must be specified. +# derive_var_trtemfl Test 11: error if `group_var` specified without `subject_keys` + + Code + derive_var_trtemfl(adae2, group_var = AEGRPID, subject_keys = NULL) + Condition + Error in `derive_var_trtemfl()`: + ! `group_var` argument was specified but not `subject_keys` + `subject_keys` argument must be provided when `group_var` is specified. + diff --git a/tests/testthat/test-derive_var_trtemfl.R b/tests/testthat/test-derive_var_trtemfl.R index c110da5730..181f9007c0 100644 --- a/tests/testthat/test-derive_var_trtemfl.R +++ b/tests/testthat/test-derive_var_trtemfl.R @@ -194,7 +194,7 @@ test_that("derive_var_trtemfl Test 9: error if `intensity` without `initial_inte }) ## Test 10: warning if both `initial_intensity` and `group_var` are specified ---- -test_that("derive_var_trtemfl Test 9: error if `intensity` without `initial_intensity`", { +test_that("derive_var_trtemfl Test 10: error if `intensity` without `initial_intensity`", { expect_warning( derive_var_trtemfl( adae2, @@ -204,3 +204,15 @@ test_that("derive_var_trtemfl Test 9: error if `intensity` without `initial_inte "`initial_intensity` argument is ignored when `group_var` is specified" ) }) + +## Test 11: error if `group_var` specified without `subject_keys` ---- +test_that("derive_var_trtemfl Test 11: error if `group_var` specified without `subject_keys`", { + expect_snapshot( + derive_var_trtemfl( + adae2, + group_var = AEGRPID, + subject_keys = NULL + ), + error = TRUE + ) +}) From 501303d53e1e7440706876b0ee544b37ba67edc2 Mon Sep 17 00:00:00 2001 From: jimrothstein Date: Fri, 20 Dec 2024 16:03:33 -0800 Subject: [PATCH 2/3] # 2581 coverage derive_var_trtemfl, Test #11 add --- tests/testthat/_snaps/derive_var_trtemfl.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/testthat/_snaps/derive_var_trtemfl.md b/tests/testthat/_snaps/derive_var_trtemfl.md index 213f028e42..607f736f26 100644 --- a/tests/testthat/_snaps/derive_var_trtemfl.md +++ b/tests/testthat/_snaps/derive_var_trtemfl.md @@ -34,17 +34,10 @@ ! `intensity` argument was specified but not `initial_intensity` Either both or none of them must be specified. -<<<<<<< HEAD # derive_var_trtemfl Test 11: error if `group_var` specified without `subject_keys` Code derive_var_trtemfl(adae2, group_var = AEGRPID, subject_keys = NULL) -======= -# derive_var_trtemfl Test 11: error if `group_var` without `subject_keys` - - Code - derive_var_trtemfl(adae, group_var = AEGRPID, subject_keys = NULL) ->>>>>>> main Condition Error in `derive_var_trtemfl()`: ! `group_var` argument was specified but not `subject_keys` From 00f52d2c2b4700e8d6a2d67473e03e0fb6c2b4d9 Mon Sep 17 00:00:00 2001 From: jimrothstein Date: Sun, 22 Dec 2024 14:36:34 -0800 Subject: [PATCH 3/3] git checkout 49a2b19d1 -- admiral.Rproj; should (1) replace admiral.Rproj as it was in commit 49a2b19d1 and (2) make commit, so older history is not changed --- admiral.Rproj | 1 - 1 file changed, 1 deletion(-) diff --git a/admiral.Rproj b/admiral.Rproj index cdb9238896..576c7085e4 100644 --- a/admiral.Rproj +++ b/admiral.Rproj @@ -1,5 +1,4 @@ Version: 1.0 -ProjectId: 07f3544c-317e-4fa8-ba3b-310457396203 RestoreWorkspace: No SaveWorkspace: No