tests/testthat/test_colors.R

context("Colors and palettes")

test_that("Test color palettes", {
    skip_on_cran()

    expect_true(all(is_color(cases_pal(1))))
    expect_true(all(is_color(cases_pal(100))))
    expect_true(all(is_color(spectral(1))))
    expect_true(all(is_color(spectral(100))))

    msg <- "n is not a number"
    expect_error(cases_pal("asd"), msg)

})






test_that("Test transp", {
    skip_on_cran()

    col <- cases_pal(100)
    expect_true(all(is_color(transp(col))))

})






test_that("Test fac2col", {
    skip_on_cran()

    x <- sample(letters[1:5], 50, replace = TRUE)
    expect_true(all(is_color(fac2col(x))))
    expect_length(fac2col(x), length(x))

})

Try the epicontacts package in your browser

Any scripts or data that you put into this service are public.

epicontacts documentation built on March 31, 2023, 6:49 p.m.