tests/testthat/test-unique-values.R

test_that("get_unique_values returns values for RasterLayer", {
   expect_length(get_unique_values(landscape)[[1]], n = 3)
})

test_that("get_unique_values returns values for a matrix", {
    expect_length(get_unique_values(terra::as.matrix(landscape, wide = TRUE))[[1]], n = 3)
})

test_that("get_unique_values returns values for a matrix", {
    expect_length(get_unique_values(terra::as.matrix(landscape, wide = TRUE))[[1]], n = 3)
})

Try the landscapemetrics package in your browser

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

landscapemetrics documentation built on April 4, 2025, 2:17 a.m.