mirror of
https://github.com/msberends/AMR.git
synced 2025-07-08 18:41:58 +02:00
more unit tests
This commit is contained in:
@ -17,7 +17,6 @@ test_that("first isolates work", {
|
||||
info = FALSE)), 1960)
|
||||
|
||||
# septic_patients contains 1962 out of 2000 first *weighted* isolates
|
||||
#septic_ptns$keyab <- suppressWarnings(key_antibiotics(septic_ptns))
|
||||
expect_equal(
|
||||
suppressWarnings(sum(
|
||||
first_isolate(tbl = septic_patients %>% mutate(keyab = key_antibiotics(.)),
|
||||
@ -29,6 +28,13 @@ test_that("first isolates work", {
|
||||
info = TRUE))),
|
||||
1962)
|
||||
|
||||
# septic_patients contains 1733 out of 2000 first non-ICU isolates
|
||||
expect_equal(
|
||||
sum(
|
||||
first_isolate(septic_patients, col_bactid = "bactid", col_date = "date", col_patient_id = "patient_id", col_icu = "ward_icu", info = TRUE, icu_exclude = TRUE)),
|
||||
1733
|
||||
)
|
||||
|
||||
# set 1500 random observations to be of specimen type 'Urine'
|
||||
random_rows <- sample(x = 1:2000, size = 1500, replace = FALSE)
|
||||
expect_lt(sum(
|
||||
|
@ -1,7 +1,7 @@
|
||||
context("misc.R")
|
||||
|
||||
test_that("`like` works", {
|
||||
expect_true("test" %like% "^t")
|
||||
expect_true(suppressWarnings("test" %like% c("^t", "^s")))
|
||||
expect_true("test" %like% "test")
|
||||
expect_true("test" %like% "TEST")
|
||||
expect_true(as.factor("test") %like% "TEST")
|
||||
|
@ -3,6 +3,9 @@ context("print.R")
|
||||
|
||||
test_that("tibble printing works", {
|
||||
library(dplyr)
|
||||
library(data.table)
|
||||
expect_output(print(starwars))
|
||||
expect_output(print(starwars %>% group_by(homeworld, gender)))
|
||||
expect_output(print(starwars %>% as.data.table(), print.keys = TRUE))
|
||||
expect_output(print(septic_patients))
|
||||
})
|
||||
|
Reference in New Issue
Block a user