tests/testthat/test-raster.R

context("raster")

test_that("raster_str", {
  r <- as.raster(matrix(hcl(0, 80, seq(40, 80, 10)), nrow = 5, ncol = 4))
  code <- raster_str(r, width = 50, height = 50)
  expect_gt(nchar(x = code), 50)
})

test_that("raster_write", {
  r <- as.raster(matrix(hcl(0, 80, seq(40, 80, 10)), nrow = 5, ncol = 4))
  filename <- tempfile(fileext = ".png")
  raster_write(r, path = filename, width = 50, height = 50)
  expect_true(file.exists(filename))
})

Try the gdtools package in your browser

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

gdtools documentation built on Oct. 15, 2023, 5:07 p.m.