2018-04-18 12:24:54 +02:00
|
|
|
context("mdro.R")
|
|
|
|
|
|
|
|
|
2018-11-16 20:50:50 +01:00
|
|
|
test_that("mdro works", {
|
2018-04-18 12:24:54 +02:00
|
|
|
library(dplyr)
|
|
|
|
|
2018-11-16 20:50:50 +01: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)))
|
2018-09-14 11:54:01 +02:00
|
|
|
|
2018-11-16 20:50:50 +01:00
|
|
|
outcome <- suppressWarnings(mdro(septic_patients))
|
|
|
|
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-11-16 20:50:50 +01: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),
|
2018-11-16 20:50:50 +01:00
|
|
|
c(19989, 9, 2)) # 1167 not eval., 817 neg, 14 pos, 2 unconfirmed
|
2018-04-18 12:24:54 +02:00
|
|
|
|
2018-11-16 20:50:50 +01:00
|
|
|
expect_equal(brmo(septic_patients, info = FALSE), mdro(septic_patients, "nl", info = FALSE))
|
2018-04-18 12:24:54 +02:00
|
|
|
|
2018-08-24 11:08:20 +02:00
|
|
|
# still working on German guidelines
|
2018-11-16 20:50:50 +01:00
|
|
|
expect_error(suppressWarnings(mrgn(septic_patients, info = TRUE)))
|
2018-08-24 11:08:20 +02:00
|
|
|
|
2018-04-18 12:24:54 +02:00
|
|
|
})
|