tests/testthat/test-utils_colors.R

context("utils_colors")

test_that("set.colors attribute the proper color", {
  x = 1:10
  c = lidR:::set.colors(x, height.colors(50))

  expect_equal(length(unique(c)), length(x))

  x = rep(1,10)
  c = lidR:::set.colors(x, height.colors(50))

  expect_equal(c, "#0000FF")
})

test_that("colors palette works", {
  expect_error(random.colors(10), NA)
  expect_error(forest.colors(10), NA)
  expect_error(pastel.colors(10), NA)
  expect_error(height.colors(10), NA)
})

Try the lidR package in your browser

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

lidR documentation built on Sept. 11, 2024, 5:21 p.m.