Skip to content

Commit

Permalink
Merge pull request #65 from katilingban/dev
Browse files Browse the repository at this point in the history
create tests for utils functions
  • Loading branch information
ernestguevarra authored Mar 12, 2024
2 parents 3aba3c1 + c6187f1 commit 8cd0a59
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
# Tests for utility functions --------------------------------------------------

## Test get colours function ----
testthat::expect_type(get_colours(pattern = "Blue"), "character")
testthat::expect_type(get_colours(pattern = "Blue", named = TRUE), "character")
testthat::expect_type(tint_colour(acdc_green, p = 0.2), "character")


## Test tint colours function ----
testthat::expect_type(tint_colours(c(acdc_green, acdc_gold), p = 0.2), "list")
testthat::expect_type(tint_colours(c(acdc_green, acdc_gold), p = c(0.2, 0.4)), "list")
testthat::expect_equal(
tint_colours(
c(acdc_green, acdc_gold),
p = c(0.2, 0.4)
) |>
(\(x) x[[1]])() |>
length(),
2
)


## Test shade colours function ----
testthat::expect_type(shade_colours(c(acdc_green, acdc_gold), p = 0.2), "list")
testthat::expect_type(shade_colours(c(acdc_green, acdc_gold), p = c(0.2, 0.4)), "list")
testthat::expect_equal(
shade_colours(
c(acdc_green, acdc_gold),
p = c(0.2, 0.4)
) |>
(\(x) x[[1]])() |>
length(),
2
)

0 comments on commit 8cd0a59

Please sign in to comment.