Skip to content

Commit

Permalink
changes for #15 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
topepo authored Oct 23, 2024
1 parent c57e0ad commit f42b705
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions R/checks.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
check_numeric <- function(x, input = "`x`", call = rlang::caller_env()) {
check_numeric <- function(x, input = "x", call = rlang::caller_env()) {
if (!is.vector(x) || !is.numeric(x)) {
cli::cli_abort("{.arg {input}} should be {an} numeric vector.")
cli::cli_abort("{.arg {input}} should be a numeric vector.")
}
invisible(NULL)
}
Expand Down
16 changes: 16 additions & 0 deletions tests/testthat/_snaps/in-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,19 @@
Error in `d_category()`:
! Desirability values should be numeric and complete in the range [0, 1].

---

Code
d_min(letters, 1, 2)
Condition
Error in `check_numeric()`:
! `x` should be a numeric vector.

---

Code
d_min(letters[1], 1, 2)
Condition
Error in `check_numeric()`:
! `x` should be a numeric vector.

5 changes: 5 additions & 0 deletions tests/testthat/test-in-line.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ test_that('correct values', {
oob[1] <- 10
expect_snapshot(d_category(month.abb[2:4], oob), error = TRUE)

# ------------------------------------------------------------------------------

expect_snapshot(d_min(letters, 1, 2), error = TRUE)
expect_snapshot(d_min(letters[1], 1, 2), error = TRUE)

})

test_that('missing values', {
Expand Down
5 changes: 0 additions & 5 deletions tests/testthat/test-overall.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@

test_that('tolerance values', {


})

test_that('overall desirability computations', {

expect_equal(
Expand Down

0 comments on commit f42b705

Please sign in to comment.