Skip to content
Snippets Groups Projects
Commit abf93578 authored by Nathalie Vialaneix's avatar Nathalie Vialaneix
Browse files

added tests on inputs for SFCB function

parent 629d1e85
No related branches found
No related tags found
No related merge requests found
......@@ -91,3 +91,31 @@ test_that("`sfcb` works for one `at` with selection.", {
range.at = c(5, 12))
expect_named(out14, expected_outputs)
})
test_that("`sfcb` properly returns error when expected.", {
expect_error({sfcb(rainfall, truffles, at = "1")},
"'at' must be a positive integer", fixed = FALSE)
expect_error({sfcb(rainfall, truffles, at = -3)},
"'at' must be a positive integer", fixed = FALSE)
expect_error({sfcb(rainfall, truffles, at = 2.4)},
"'at' must be a positive integer", fixed = FALSE)
expect_error({sfcb(rainfall, truffles, range.at = 1:3)},
"'range.at' must be a vector of minimum and maximum numbers",
fixed = FALSE)
expect_error({sfcb(rainfall, truffles, range.at = c("1", "2"))},
"'range.at' must be a vector of minimum and maximum numbers",
fixed = FALSE)
expect_error({sfcb(rainfall, truffles, range.at = c(-1, 2))},
"'range.at' must be a vector of minimum and maximum numbers",
fixed = FALSE)
expect_error({sfcb(rainfall, truffles, range.at = c(1.4, 2))},
"'range.at' must be a vector of minimum and maximum numbers",
fixed = FALSE)
expect_error({sfcb(rainfall, truffles, range.at = c(5, 2))},
"'range.at' must be a vector of minimum and maximum numbers",
fixed = FALSE)
expect_error({sfcb(rainfall, truffles, seed = "1")},
"'seed' must be numeric!", fixed = FALSE)
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment