Skip to content

Commit

Permalink
rename utilities test file
Browse files Browse the repository at this point in the history
in preparation for #209
  • Loading branch information
wibeasley committed May 29, 2018
1 parent 39a317e commit ce2de55
Showing 1 changed file with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
library(testthat)
context("Replace NAs")
context("collapse_vector")

test_that("replace_nas_character_standard", {
a <- letters
missing_indices <- c(3, 6, 8, 25)
a[missing_indices] <- NA_character_
test_that("both NULL", {
elements <- NULL
collapsed <- NULL
expected <- ""

expected <- c("a", "b", "Unknown", "d", "e", "Unknown", "g", "Unknown", "i", "j", "k", "l", "m",
"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "Unknown", "z")

a <- REDCapR:::replace_nas_with_explicit(a)
expect_equal(a, expected, label="The correct letters should have been replaced.")
expect_equal(class(a), "character", "The returned array should remain a character.")
observed <- REDCapR:::collapse_vector(elements, collapsed)
expect_equal(observed, expected)
})

test_that("replace_nas_factor_standard", {
Expand Down

0 comments on commit ce2de55

Please sign in to comment.