unit tests

This commit is contained in:
dr. M.S. (Matthijs) Berends 2023-02-14 15:59:40 +01:00
parent a4cd38c433
commit 8d37c75860
8 changed files with 13 additions and 36 deletions

View File

@ -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)

View File

@ -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!)*

View File

@ -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)),

View File

@ -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"))

View File

@ -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)))

View File

@ -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")) {

View File

@ -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,

View File

@ -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),