1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-28 05:26:12 +01:00
AMR/tests/testthat/test-atc.R

32 lines
1.2 KiB
R
Raw Normal View History

2018-03-27 17:43:42 +02:00
context("atc.R")
test_that("atc_property works", {
expect_equal(tolower(atc_property("J01CA04", property = "Name")), "amoxicillin")
expect_equivalent(atc_property("J01CA04", "DDD"), 1)
})
test_that("abname works", {
expect_equal(abname("AMOX"), "Amoxicillin")
expect_equal(abname(c("AMOX", "GENT")), c("Amoxicillin", "Gentamicin"))
2018-04-02 16:05:09 +02:00
expect_equal(abname(c("AMOX+GENT")), "Amoxicillin + gentamicin")
2018-03-27 17:43:42 +02:00
expect_equal(abname("AMOX", from = 'umcg'), "Amoxicillin")
expect_equal(abname("amox", from = 'molis'), "Amoxicillin")
expect_equal(abname("J01CA04", from = 'atc'), "Amoxicillin")
})
2018-04-03 16:07:32 +02:00
test_that("guess_bactid works", {
expect_identical(guess_bactid(c("E. coli", "H. influenzae")), c("ESCCOL", "HAEINF"))
expect_equal(guess_bactid("Escherichia coli"), "ESCCOL")
expect_equal(guess_bactid("Negative rods"), "GNR")
expect_equal(guess_bactid(c("stau",
"STAU",
"staaur",
"S. aureus",
"S aureus",
"Staphylococcus aureus",
"MRSA",
"VISA")),
rep("STAAUR", 8))
})