2018-08-28 13:51:13 +02:00
|
|
|
context("mo_property.R")
|
|
|
|
|
|
|
|
test_that("mo_property works", {
|
2018-09-24 23:33:29 +02:00
|
|
|
expect_equal(mo_subkingdom("E. coli"), "Negibacteria")
|
2018-09-17 20:53:32 +02:00
|
|
|
expect_equal(mo_phylum("E. coli"), "Proteobacteria")
|
|
|
|
expect_equal(mo_class("E. coli"), "Gammaproteobacteria")
|
|
|
|
expect_equal(mo_order("E. coli"), "Enterobacteriales")
|
2018-08-28 13:51:13 +02:00
|
|
|
expect_equal(mo_family("E. coli"), "Enterobacteriaceae")
|
|
|
|
expect_equal(mo_genus("E. coli"), "Escherichia")
|
|
|
|
expect_equal(mo_species("E. coli"), "coli")
|
2018-09-27 23:23:48 +02:00
|
|
|
expect_equal(mo_subspecies("E. coli"), NA_character_)
|
2018-08-28 13:51:13 +02:00
|
|
|
expect_equal(mo_fullname("E. coli"), "Escherichia coli")
|
2018-09-08 16:06:47 +02:00
|
|
|
expect_equal(mo_type("E. coli", language = "en"), "Bacteria")
|
2018-09-24 23:33:29 +02:00
|
|
|
expect_equal(mo_gramstain("E. coli", language = "en"), "Gram negative")
|
2018-09-17 21:51:21 +02:00
|
|
|
expect_equal(class(mo_taxonomy("E. coli")), "list")
|
2018-09-27 23:23:48 +02:00
|
|
|
expect_equal(names(mo_taxonomy("E. coli")), c("subkingdom", "phylum", "class", "order",
|
|
|
|
"family", "genus", "species", "subspecies"))
|
2018-09-04 11:33:30 +02:00
|
|
|
|
2018-09-05 10:51:46 +02:00
|
|
|
expect_equal(mo_shortname("MRSA"), "S. aureus")
|
|
|
|
expect_equal(mo_shortname("MRSA", Becker = TRUE), "S. aureus")
|
|
|
|
expect_equal(mo_shortname("MRSA", Becker = "all"), "CoPS")
|
|
|
|
expect_equal(mo_shortname("S. aga"), "S. agalactiae")
|
|
|
|
expect_equal(mo_shortname("S. aga", Lancefield = TRUE), "GBS")
|
|
|
|
|
2018-09-10 11:40:54 +02:00
|
|
|
# test integrity
|
2018-09-27 23:23:48 +02:00
|
|
|
MOs <- AMR::microorganisms
|
|
|
|
expect_identical(MOs$fullname, mo_fullname(MOs$fullname, language = "en"))
|
2018-09-10 11:40:54 +02:00
|
|
|
|
2018-09-10 15:45:25 +02:00
|
|
|
# check languages
|
2018-09-24 23:33:29 +02:00
|
|
|
expect_equal(mo_type("E. coli", language = "de"), "Bakterien")
|
|
|
|
expect_equal(mo_gramstain("E. coli", language = "nl"), "Gram-negatief")
|
2018-09-10 15:45:25 +02:00
|
|
|
|
|
|
|
expect_output(print(mo_gramstain("E. coli", language = "en")))
|
|
|
|
expect_output(print(mo_gramstain("E. coli", language = "de")))
|
|
|
|
expect_output(print(mo_gramstain("E. coli", language = "nl")))
|
|
|
|
expect_output(print(mo_gramstain("E. coli", language = "es")))
|
|
|
|
expect_output(print(mo_gramstain("E. coli", language = "pt")))
|
|
|
|
expect_output(print(mo_gramstain("E. coli", language = "it")))
|
|
|
|
expect_output(print(mo_gramstain("E. coli", language = "fr")))
|
|
|
|
|
|
|
|
expect_error(mo_gramstain("E. coli", language = "UNKNOWN"))
|
|
|
|
|
2018-08-28 13:51:13 +02:00
|
|
|
})
|