-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-utils.R
More file actions
28 lines (23 loc) · 1018 Bytes
/
test-utils.R
File metadata and controls
28 lines (23 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
test_that("include_exclude_from works", {
from <- c("a", "b")
expect_equal(include_exclude_from(from = from), from)
expect_equal(include_exclude_from(from = from, exclude = "a"), "b")
expect_equal(include_exclude_from(from = from, include = "c"), "c")
})
test_that("All riskmetric:::pkg_ref_class_hierarchy have value to display in our report", {
allowed_names <- unlist(riskmetric:::pkg_ref_class_hierarchy)
expect_true(all(!is.na(sapply(allowed_names, get_pkg_origin))))
})
test_that("is_empty returns TRUE if the argument is withint the expected empty categories", {
expect_true(is_empty(NULL))
expect_true(is_empty(NA))
expect_true(is_empty(""))
expect_false(is_empty(letters[1]))
})
test_that("replace_zero_or_false_by_no returns 'No' if value is zero ir FALSE", {
value_1 <- FALSE
value_2 <- 0
expect_identical("No", replace_zero_or_false_by_no(value_1))
expect_identical("No", replace_zero_or_false_by_no(value_2))
expect_identical(TRUE, replace_zero_or_false_by_no(TRUE))
})