tests/testthat/test-helpers.R

context("test-helpers")

test_that("Raster mean and sd returns a raster from the mean and sd", {

  host_file <-
    system.file("extdata", "simple20x20", "host_w_sd.tif", package = "PoPS")
  host <- terra::rast(host_file)
  hosts <- output_from_raster_mean_and_sd(host)
  hosts2 <- output_from_raster_mean_and_sd(host)
  expect_true(any(hosts[hosts > host[[1]]] > 0))
  expect_true(any(hosts[hosts == host[[1]]] > 0))
  expect_true(any(hosts[hosts < host[[1]]] > 0))
  expect_true(any(hosts2[hosts2 > host[[1]]] > 0))
  expect_true(any(hosts2[hosts2 == host[[1]]] > 0))
  expect_true(any(hosts2[hosts2 < host[[1]]] > 0))

})
ncsu-landscape-dynamics/rpops documentation built on May 1, 2024, 10:21 a.m.