1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 11:11:54 +02:00

(v0.6.1.9053) prerelease fixes

This commit is contained in:
2019-06-02 19:23:19 +02:00
parent 8de0495008
commit bd73988f15
38 changed files with 337 additions and 327 deletions

View File

@ -66,7 +66,7 @@ test_that("frequency table works", {
# rsi
expect_output(print(freq(septic_patients$AMC)))
# hms
expect_output(suppressWarnings(print(freq(hms::as.hms(sample(c(0:86399), 50))))))
expect_output(print(freq(hms::as.hms(sample(c(0:86399), 50)))))
# matrix
expect_output(print(freq(as.matrix(septic_patients$age))))
expect_output(print(freq(as.matrix(septic_patients[, c("age", "gender")]))))
@ -74,10 +74,10 @@ test_that("frequency table works", {
expect_output(print(freq(list(age = septic_patients$age))))
expect_output(print(freq(list(age = septic_patients$age, gender = septic_patients$gender))))
# difftime
expect_output(suppressWarnings(print(
expect_output(print(
freq(difftime(Sys.time(),
Sys.time() - runif(5, min = 0, max = 60 * 60 * 24),
units = "hours")))))
units = "hours"))))
expect_output(print(freq(septic_patients$age)[,1:3]))

View File

@ -247,11 +247,13 @@ test_that("as.mo works", {
# summary
expect_equal(length(summary(septic_patients$mo)), 6)
# other
expect_equal(as.character(as.mo(c("xxx", "con", "na", "nan"), debug = TRUE)),
rep(NA_character_, 4))
expect_equal(as.character(as.mo(c("other", "none", "unknown"))),
# WHONET codes and NA/NaN
expect_equal(as.character(as.mo(c("xxx", "na", "nan"), debug = TRUE)),
rep(NA_character_, 3))
expect_equal(as.character(as.mo("con")), "UNKNOWN")
expect_equal(as.character(as.mo("xxx")), NA_character_)
expect_equal(as.character(as.mo(c("xxx", "con"))), c(NA_character_, "UNKNOWN"))
expect_equal(as.character(as.mo(c("other", "none", "unknown"))),
rep("UNKNOWN", 3))
expect_null(mo_failures())