Skip to content

Commit

Permalink
forgot test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Zelos Zhu committed Oct 6, 2023
1 parent e34b55b commit e8a7ef9
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 334 deletions.
10 changes: 0 additions & 10 deletions tests/testthat/test-compute_kidney.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,6 @@ test_that("compute_egfr Test 7: CKD-EPI calculated on input data", {
)
})

<<<<<<< HEAD
## Test 8: Deprecate wt ----
test_that("compute_egfr Test 8: 'wt' argument deprecation warning", {
# expect deprecation warning
expect_warning(
compute_egfr(
creat = 1.09, creatu = "mg/dL", age = 55, sex = "M", wt = 90, method = "CRCL"
)
=======
## Test 8: 'wt' argument deprecation warning ----
test_that("compute_egfr Test 8: 'wt' argument deprecation warning", {
# expect deprecation warning
Expand All @@ -117,6 +108,5 @@ test_that("compute_egfr Test 8: 'wt' argument deprecation warning", {
creat = 1.09, creatu = "mg/dL", age = 55, sex = "M", wt = 90, method = "CRCL"
),
class = "lifecycle_error_deprecated"
>>>>>>> b800ab103ddbf55701d4f6b2ed0080d3c3525f27
)
})
78 changes: 0 additions & 78 deletions tests/testthat/test-derive_extreme_records.R
Original file line number Diff line number Diff line change
Expand Up @@ -299,76 +299,8 @@ test_that("derive_extreme_records Test 5: latest evaluable tumor assessment date
)
})

<<<<<<< HEAD
## Test 6: warning if filter argument is used ----
test_that("derive_extreme_records Test 6: warning if filter argument is used", {
adsl <- tibble::tribble(
~USUBJID,
"1",
"2",
"3"
) %>%
mutate(STUDYID = "XX1234")

adrs <- tibble::tribble(
~USUBJID, ~ADTC, ~AVALC, ~PARAMCD,
"1", "2020-01-02", "PR", "OVR",
"1", "2020-02-01", "CR", "OVR",
"1", "2020-03-01", "NE", "OVR",
"1", "2020-04-01", "SD", "OVR",
"2", "2021-06-15", "SD", "OVR",
"2", "2021-07-16", "SD", "OVR",
"2", "2021-09-14", "NE", "OVR",
"3", "2021-08-03", "NE", "OVR",
) %>%
mutate(
STUDYID = "XX1234",
ADT = ymd(ADTC)
) %>%
select(-ADTC)

actual <- derive_extreme_records(
adrs,
dataset_ref = adsl,
dataset_add = adrs,
by_vars = exprs(USUBJID),
filter_add = PARAMCD == "OVR" & AVALC == "PD",
exist_flag = AVALC,
order = exprs(ADT),
mode = "first",
set_values_to = exprs(
PARAMCD = "PD",
ANL01FL = "Y",
ADT = ADT
)
)

expect_error(
derive_extreme_records(
adrs,
dataset_ref = adsl,
dataset_add = adrs,
by_vars = exprs(USUBJID),
filter = PARAMCD == "OVR" & AVALC == "PD",
exist_flag = AVALC,
order = exprs(ADT),
mode = "first",
set_values_to = exprs(
PARAMCD = "PD",
ANL01FL = "Y",
ADT = ADT
)
),
class = "lifecycle_error_deprecated"
)
})

## Test 7: error if no input data ----
test_that("derive_extreme_records Test 7: error if no input data", {
=======
## Test 6: error if no input data ----
test_that("derive_extreme_records Test 6: error if no input data", {
>>>>>>> b800ab103ddbf55701d4f6b2ed0080d3c3525f27
expect_error(
derive_extreme_records(
set_values_to = exprs(PARAMCD = "HELLO")
Expand All @@ -382,13 +314,8 @@ test_that("derive_extreme_records Test 6: error if no input data", {
)
})

<<<<<<< HEAD
## Test 8: keep vars in `keep_source_vars` in the new records ----
test_that("derive_extreme_records Test 8: keep vars in `keep_source_vars` in the new records", {
=======
## Test 7: keep vars in `keep_source_vars` in the new records ----
test_that("derive_extreme_records Test 7: keep vars in `keep_source_vars` in the new records", {
>>>>>>> b800ab103ddbf55701d4f6b2ed0080d3c3525f27
input <- tibble::tribble(
~USUBJID, ~AVISITN, ~AVAL, ~LBSEQ,
1, 1, 12, 1,
Expand Down Expand Up @@ -426,13 +353,8 @@ test_that("derive_extreme_records Test 7: keep vars in `keep_source_vars` in the
)
})

<<<<<<< HEAD
## Test 9: keep all vars in the new records when `keep_source_vars` is 'exprs(everything())' ----
test_that("derive_extreme_records Test 9: keep all vars in the new records when `keep_source_vars` is 'exprs(everything())'", { # nolint
=======
## Test 8: keep all vars in the new records when `keep_source_vars` is 'exprs(everything())' ----
test_that("derive_extreme_records Test 8: keep all vars in the new records when `keep_source_vars` is 'exprs(everything())'", { # nolint
>>>>>>> b800ab103ddbf55701d4f6b2ed0080d3c3525f27
input <- tibble::tribble(
~USUBJID, ~AVISITN, ~AVAL, ~LBSEQ,
1, 1, 12, 1,
Expand Down
Loading

0 comments on commit e8a7ef9

Please sign in to comment.