mirror of
https://github.com/msberends/AMR.git
synced 2024-12-24 18:46:14 +01:00
unit tests
This commit is contained in:
parent
a4cd38c433
commit
8d37c75860
@ -1,5 +1,5 @@
|
||||
Package: AMR
|
||||
Version: 1.8.2.9124
|
||||
Version: 1.8.2.9125
|
||||
Date: 2023-02-14
|
||||
Title: Antimicrobial Resistance Data Analysis
|
||||
Description: Functions to simplify and standardise antimicrobial resistance (AMR)
|
||||
|
2
NEWS.md
2
NEWS.md
@ -1,4 +1,4 @@
|
||||
# AMR 1.8.2.9124
|
||||
# AMR 1.8.2.9125
|
||||
|
||||
*(this beta version will eventually become v2.0! We're happy to reach a new major milestone soon!)*
|
||||
|
||||
|
@ -49,15 +49,8 @@ expect_error(age(
|
||||
reference = c("2019-01-01", "2019-01-01")
|
||||
))
|
||||
|
||||
# expect_warning(age(
|
||||
x = c("1980-01-01", "1985-01-01", "1990-01-01"),
|
||||
reference = "1975-01-01"
|
||||
))
|
||||
|
||||
# expect_warning(age(
|
||||
x = c("1800-01-01", "1805-01-01", "1810-01-01"),
|
||||
reference = "2019-01-01"
|
||||
))
|
||||
# expect_warning(age(x = c("1980-01-01", "1985-01-01", "1990-01-01"), reference = "1975-01-01"))
|
||||
# expect_warning(age(x = c("1800-01-01", "1805-01-01", "1810-01-01"), reference = "2019-01-01"))
|
||||
|
||||
expect_equal(
|
||||
length(age(x = c("2019-01-01", NA), na.rm = TRUE)),
|
||||
|
@ -47,10 +47,7 @@ expect_equal(
|
||||
# warning for speed loss
|
||||
# expect_warning(count_resistant(as.character(example_isolates$AMC)))
|
||||
|
||||
# expect_warning(count_resistant(
|
||||
example_isolates$AMC,
|
||||
as.character(example_isolates$GEN)
|
||||
))
|
||||
# expect_warning(count_resistant(example_isolates$AMC, as.character(example_isolates$GEN)))
|
||||
|
||||
# check for errors
|
||||
expect_error(count_resistant("test", minimum = "test"))
|
||||
|
@ -63,11 +63,7 @@ x <- as.data.frame(
|
||||
# expect_warning(g.test(x))
|
||||
expect_true(suppressWarnings(g.test(x)$p.value) < 1)
|
||||
|
||||
# expect_warning(g.test(
|
||||
x = c(772, 1611, 737),
|
||||
y = c(780, 1560, 780),
|
||||
rescale.p = TRUE
|
||||
))
|
||||
# expect_warning(g.test(x = c(772, 1611, 737), y = c(780, 1560, 780), rescale.p = TRUE))
|
||||
|
||||
expect_error(g.test(matrix(data = c(-1, -2, -3, -4), ncol = 2, byrow = TRUE)))
|
||||
expect_error(g.test(matrix(data = c(0, 0, 0, 0), ncol = 2, byrow = TRUE)))
|
||||
|
@ -272,10 +272,10 @@ expect_error(custom_mdro_guideline("test"))
|
||||
expect_error(custom_mdro_guideline("test" ~ c(1:3)))
|
||||
expect_error(custom_mdro_guideline("test" ~ A))
|
||||
# expect_warning(mdro(example_isolates,
|
||||
# since `test` gives an error, it will be ignored with a warning
|
||||
guideline = custom_mdro_guideline(test ~ "A"),
|
||||
info = FALSE
|
||||
))
|
||||
# # since `test` gives an error, it will be ignored with a warning
|
||||
# guideline = custom_mdro_guideline(test ~ "A"),
|
||||
# info = FALSE
|
||||
# ))
|
||||
|
||||
# print groups
|
||||
if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
|
||||
|
@ -115,15 +115,9 @@ if (AMR:::pkg_is_available("dplyr", min_version = "1.0.0")) {
|
||||
|
||||
# expect_warning(proportion_R(as.character(example_isolates$AMC)))
|
||||
# expect_warning(proportion_S(as.character(example_isolates$AMC)))
|
||||
# expect_warning(proportion_S(as.character(
|
||||
example_isolates$AMC,
|
||||
example_isolates$GEN
|
||||
)))
|
||||
# expect_warning(proportion_S(as.character(example_isolates$AMC, example_isolates$GEN)))
|
||||
|
||||
# expect_warning(n_sir(as.character(
|
||||
example_isolates$AMC,
|
||||
example_isolates$GEN
|
||||
)))
|
||||
# expect_warning(n_sir(as.character(example_isolates$AMC, example_isolates$GEN)))
|
||||
expect_equal(
|
||||
suppressWarnings(n_sir(as.character(
|
||||
example_isolates$AMC,
|
||||
|
@ -236,10 +236,7 @@ expect_inherits(
|
||||
))$amoxi),
|
||||
"sir"
|
||||
)
|
||||
# expect_warning(as.sir(data.frame(
|
||||
mo = "E. coli",
|
||||
NIT = c("<= 2", 32)
|
||||
)))
|
||||
# expect_warning(as.sir(data.frame(mo = "E. coli", NIT = c("<= 2", 32))))
|
||||
expect_message(as.sir(data.frame(
|
||||
mo = "E. coli",
|
||||
NIT = c("<= 2", 32),
|
||||
|
Loading…
Reference in New Issue
Block a user