Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 2, 2024
1 parent fd2f89b commit 0f377ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/testthat/test-categorize.R
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,13 @@ test_that("categorize labelling ranged", {
expect_snapshot(categorize(mtcars$mpg, "equal_length", n_groups = 5))
expect_snapshot(categorize(mtcars$mpg, "equal_length", n_groups = 5, labels = "range"))
expect_snapshot(categorize(mtcars$mpg, "equal_length", n_groups = 5, labels = "observed"))
})

test_that("categorize breaks", {
data(mtcars)
expect_snapshot(categorize(mtcars$mpg, "equal_length", n_groups = 5, labels = "observed", breaks = "inclusive"))
expect_error(
categorize(mtcars$mpg, "equal_length", n_groups = 5, breaks = "something"),
regex = "should be one of"
)
})

0 comments on commit 0f377ca

Please sign in to comment.