small improvement for is.rsi.eligible, more unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends committed 2018-09-14 11:54:01 +02:00
1 parent cf5711fb0b
commit b0ca49d68d
6 files changed
+31 -29

No files matched your search

+6 -1
View File
@@ -4,7 +4,12 @@ context("mdro.R")
test_that("MDRO works", {
library(dplyr)
outcome <- suppressWarnings(MDRO(septic_patients, "EUCAST", info = TRUE))
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))
outcome <- suppressWarnings(EUCAST_exceptional_phenotypes(septic_patients, info = TRUE))
# check class
expect_equal(outcome %>% class(), c('ordered', 'factor'))
+6 -1
View File
@@ -22,6 +22,11 @@ test_that("as.mo works", {
expect_equal(as.character(as.mo("L. pneumophila")), "LEGPNE")
expect_equal(as.character(as.mo("L. non pneumophila")), "LEGNON")
expect_equal(as.character(as.mo("S. beta-haemolytic")), "STCHAE")
expect_equal(as.character(as.mo("Strepto")), "STC") # not Streptobacillus
expect_equal(as.character(as.mo("Streptococcus")), "STC") # not Peptostreptoccus
expect_equal(as.character(as.mo(c("GAS", "GBS"))), c("STCGRA", "STCGRB"))
expect_equal(as.character(as.mo("S. pyo")), "STCPYO") # not Actinomyces pyogenes
@@ -31,7 +36,7 @@ test_that("as.mo works", {
expect_equal(as.character(as.mo("Gram negative rods")), "GNR")
# GLIMS
expect_equal(as.character(as.mo("shiboy")), "SHIBOY")
expect_equal(as.character(as.mo("bctfgr")), "BACFRA")
expect_equal(as.character(as.mo("MRSE")), "STAEPI")
expect_equal(as.character(as.mo("VRE")), "ENC")