Skip to content

Commit

Permalink
Update tests/testthat/test-percent_james.R
Browse files Browse the repository at this point in the history
  • Loading branch information
Moohan authored Dec 16, 2024
1 parent 866f581 commit 37f913b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/testthat/test-percent_james.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ test_that("as_percent works correctly", {
expect_equal(as.character(as_percent(0.005)), "0.5%")
expect_equal(as.character(as_percent(0.0005)), "0.05%")
expect_equal(as.character(as_percent(0.00005)), "0.01%")

expect_equal(format(as_percent(50)), "5,000%")
expect_equal(format(as_percent(5)), "500%")
expect_equal(format(as_percent(0.5)), "50%")
expect_equal(format(as_percent(0.05)), "5%")
expect_equal(format(as_percent(0.005)), "0.5%")
expect_equal(format(as_percent(0.0005)), "0.05%")
expect_equal(format(as_percent(0.00005)), "0.01%")
})

test_that("as_percent handles non-numeric input", {
Expand Down

0 comments on commit 37f913b

Please sign in to comment.