tests/testthat/test-aqiPalette.R

context("aqiPalette")

test_that("arguments are validated", {
  expect_error(aqiPalette("not-a-palette-name"))
})

test_that("reverse argument works", {
  pm25 <- c(5,20,40,100,200,400)  # the middle of each AQI bin
  colors <- aqiPalette("aqi")(pm25)
  rev_colors <- aqiPalette("aqi", reverse = TRUE)(pm25)
  expect_equal(rev_colors, rev(colors))
})

Try the PWFSLSmoke package in your browser

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

PWFSLSmoke documentation built on Nov. 23, 2021, 5:06 p.m.