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

keyab fixes

This commit is contained in:
2018-07-17 19:51:09 +02:00
parent 2a4d759fbc
commit 0d64c166f0
5 changed files with 42 additions and 39 deletions

View File

@ -14,6 +14,8 @@ test_that("clipboard works", {
clipboard_import())
clipboard_export(septic_patients[1:100,])
expect_identical(as.data.frame(tbl_parse_guess(septic_patients[1:100,]), stringsAsFactors = FALSE),
clipboard_import(guess_col_types = TRUE, stringsAsFactors = FALSE))
expect_identical(as.data.frame(tbl_parse_guess(septic_patients[1:100,]),
stringsAsFactors = FALSE),
clipboard_import(guess_col_types = TRUE,
stringsAsFactors = FALSE))
})

View File

@ -3,6 +3,7 @@ context("first_isolates.R")
test_that("keyantibiotics work", {
expect_equal(length(key_antibiotics(septic_patients, info = FALSE)), nrow(septic_patients))
expect_true(key_antibiotics_equal("SSS", "SSS"))
expect_false(key_antibiotics_equal("SSS", "SRS"))
expect_true(key_antibiotics_equal("SSS", "SIS", ignore_I = TRUE))
expect_false(key_antibiotics_equal("SSS", "SIS", ignore_I = FALSE))
})
@ -19,7 +20,7 @@ test_that("first isolates work", {
na.rm = TRUE),
1959)
# septic_patients contains 1963 out of 2000 first *weighted* isolates
# septic_patients contains 1962 out of 2000 first *weighted* isolates
expect_equal(
suppressWarnings(
sum(
@ -31,7 +32,7 @@ test_that("first isolates work", {
type = "keyantibiotics",
info = TRUE),
na.rm = TRUE)),
1963)
1962)
# and 1997 when using points
expect_equal(
suppressWarnings(

View File

@ -18,3 +18,8 @@ test_that("functions missing in older R versions work", {
expect_equal(trimws(" test ", "l"), "test ")
expect_equal(trimws(" test ", "r"), " test")
})
test_that("generic dates work", {
expect_equal(date_generic("yyyy-mm-dd"), "%Y-%m-%d")
expect_equal(date_generic("dddd d mmmm yyyy"), "%A %e %B %Y")
})