2018-04-18 12:24:54 +02:00
|
|
|
context("mdro.R")
|
|
|
|
|
|
|
|
|
|
|
|
test_that("MDRO works", {
|
|
|
|
library(dplyr)
|
|
|
|
|
2018-09-14 11:54:01 +02:00
|
|
|
expect_error(suppressWarnings(MDRO(septic_patients, "invalid", col_bactid = "mo", info = TRUE)))
|
|
|
|
expect_error(suppressWarnings(MDRO(septic_patients, "fr", col_bactid = "mo", info = TRUE)))
|
|
|
|
expect_error(suppressWarnings(MDRO(septic_patients, country = c("de", "nl"), info = TRUE)))
|
|
|
|
expect_error(suppressWarnings(MDRO(septic_patients, col_mo = "invalid", info = TRUE)))
|
|
|
|
|
|
|
|
outcome <- suppressWarnings(MDRO(septic_patients))
|
2018-08-24 11:08:20 +02:00
|
|
|
outcome <- suppressWarnings(EUCAST_exceptional_phenotypes(septic_patients, info = TRUE))
|
2018-04-25 15:33:58 +02:00
|
|
|
# check class
|
|
|
|
expect_equal(outcome %>% class(), c('ordered', 'factor'))
|
|
|
|
|
2018-08-24 11:08:20 +02:00
|
|
|
outcome <- suppressWarnings(MDRO(septic_patients, "nl", info = TRUE))
|
2018-04-18 12:24:54 +02:00
|
|
|
# check class
|
|
|
|
expect_equal(outcome %>% class(), c('ordered', 'factor'))
|
|
|
|
|
|
|
|
# septic_patients should have these finding using Dutch guidelines
|
2018-07-25 14:17:04 +02:00
|
|
|
expect_equal(outcome %>% freq() %>% pull(count),
|
|
|
|
c(2, 14)) # 2 unconfirmed, 14 positive
|
2018-04-18 12:24:54 +02:00
|
|
|
|
|
|
|
expect_equal(BRMO(septic_patients, info = FALSE), MDRO(septic_patients, "nl", info = FALSE))
|
|
|
|
|
2018-08-24 11:08:20 +02:00
|
|
|
# still working on German guidelines
|
|
|
|
expect_error(suppressWarnings(MRGN(septic_patients, info = TRUE)))
|
|
|
|
|
2018-04-18 12:24:54 +02:00
|
|
|
})
|