mirror of
https://github.com/msberends/AMR.git
synced 2025-07-09 02:03:04 +02:00
abname improvement, small fixes
This commit is contained in:
19
tests/testthat/test-abname.R
Normal file
19
tests/testthat/test-abname.R
Normal file
@ -0,0 +1,19 @@
|
||||
context("abname.R")
|
||||
|
||||
test_that("abname works", {
|
||||
expect_equal(abname("AMOX"), "Amoxicillin")
|
||||
expect_equal(abname(c("AMOX", "GENT")), c("Amoxicillin", "Gentamicin"))
|
||||
expect_equal(abname(c("AMOX+GENT")), "Amoxicillin + gentamicin")
|
||||
expect_equal(abname("AMOX", from = 'umcg'), "Amoxicillin")
|
||||
expect_equal(abname("amox", from = 'molis', tolower = TRUE), "amoxicillin")
|
||||
expect_equal(abname("J01CA04", from = 'atc'), "Amoxicillin")
|
||||
expect_equal(abname(c("amox", "J01CA04", "Trimox", "dispermox", "Amoxil")),
|
||||
rep("Amoxicillin", 5))
|
||||
expect_equal(abname("AMOX", to = 'atc'), "J01CA04")
|
||||
|
||||
expect_error(abname("AMOX", to = c(1:3)))
|
||||
expect_error(abname("AMOX", to = "test"))
|
||||
expect_warning(abname("TEST
|
||||
"))
|
||||
expect_warning(abname("AMOX or GENT"))
|
||||
})
|
@ -4,7 +4,6 @@ test_that("atc_property works", {
|
||||
if (!is.null(curl::nslookup("www.whocc.no", error = FALSE))) {
|
||||
expect_equal(tolower(atc_property("J01CA04", property = "Name")), "amoxicillin")
|
||||
expect_equal(atc_property("J01CA04", property = "unit"), "g")
|
||||
|
||||
expect_equal(atc_property("J01CA04", property = "DDD"),
|
||||
atc_ddd("J01CA04"))
|
||||
|
||||
@ -19,22 +18,6 @@ test_that("atc_property works", {
|
||||
}
|
||||
})
|
||||
|
||||
test_that("abname works", {
|
||||
expect_equal(abname("AMOX"), "Amoxicillin")
|
||||
expect_equal(abname(c("AMOX", "GENT")), c("Amoxicillin", "Gentamicin"))
|
||||
expect_equal(abname(c("AMOX+GENT")), "Amoxicillin + gentamicin")
|
||||
expect_equal(abname("AMOX", from = 'umcg'), "Amoxicillin")
|
||||
expect_equal(abname("amox", from = 'molis', tolower = TRUE), "amoxicillin")
|
||||
expect_equal(abname("J01CA04", from = 'atc'), "Amoxicillin")
|
||||
expect_equal(abname("AMOX", to = 'atc'), "J01CA04")
|
||||
expect_equal(abname("AMOX en GENT"), "Amoxicillin + gentamicin")
|
||||
expect_error(abname("AMOX", to = c(1:3)))
|
||||
expect_error(abname("AMOX", to = "test"))
|
||||
expect_warning(abname("TEST
|
||||
"))
|
||||
expect_warning(abname("AMOX or GENT"))
|
||||
})
|
||||
|
||||
test_that("guess_atc works", {
|
||||
expect_equal(guess_atc(c("J01FA01",
|
||||
"Erythromycin",
|
||||
|
Reference in New Issue
Block a user