mirror of
https://github.com/msberends/AMR.git
synced 2025-08-20 02:32:27 +02:00
add tests using testthat
This commit is contained in:
31
tests/testthat/test-eucast.R
Normal file
31
tests/testthat/test-eucast.R
Normal file
@@ -0,0 +1,31 @@
|
||||
context("EUCAST.R")
|
||||
|
||||
test_that("EUCAST rules work", {
|
||||
a <- data.frame(bactid = c("KLEPNE", # Klebsiella pneumoniae
|
||||
"PSEAER", # Pseudomonas aeruginosa
|
||||
"ENTAER"), # Enterobacter aerogenes
|
||||
amox = "-", # Amoxicillin
|
||||
stringsAsFactors = FALSE)
|
||||
b <- data.frame(bactid = c("KLEPNE", # Klebsiella pneumoniae
|
||||
"PSEAER", # Pseudomonas aeruginosa
|
||||
"ENTAER"), # Enterobacter aerogenes
|
||||
amox = "R", # Amoxicillin
|
||||
stringsAsFactors = FALSE)
|
||||
expect_equal(EUCAST_rules(a, info = FALSE), b)
|
||||
expect_equal(interpretive_reading(a, info = FALSE), b)
|
||||
|
||||
a <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
|
||||
"STCGRA"), # Streptococcus pyognenes (Lancefield Group A)
|
||||
coli = "-", # Colistin
|
||||
stringsAsFactors = FALSE)
|
||||
b <- data.frame(bactid = c("STAAUR", # Staphylococcus aureus
|
||||
"STCGRA"), # Streptococcus pyognenes (Lancefield Group A)
|
||||
coli = "R", # Colistin
|
||||
stringsAsFactors = FALSE)
|
||||
expect_equal(EUCAST_rules(a, info = FALSE), b)
|
||||
})
|
||||
|
||||
test_that("MO properties work", {
|
||||
expect_equal(mo_property("ESCCOL"), "Escherichia coli")
|
||||
expect_equal(mo_property("STAAUR"), "Staphylococcus aureus")
|
||||
})
|
||||
Reference in New Issue
Block a user