tests/testthat/test-rcpp_ccl.R

mat8 <- matrix(c(NA, 1L, NA, NA, 1L, 1L, 1L, NA), 4, 2)
mat4 <- matrix(c(NA, 1L, NA, NA, 1L, 1L, 1L, NA), 4, 2)

rcpp_ccl(mat4, 4)
rcpp_ccl(mat8, 8)

test_that("rcpp_ccl patch labelling is correct", {
    expect_equal(length(get_unique_values(mat4, simplify = TRUE)), 1)
    expect_equal(length(get_unique_values(mat8, simplify = TRUE)), 1)
})
landscapeecology/landscapemetrics documentation built on April 7, 2024, 11:11 p.m.