Skip to content

Commit

Permalink
test format_area
Browse files Browse the repository at this point in the history
  • Loading branch information
Eva Marques committed Jun 6, 2024
1 parent 8dc19e9 commit 7f71ba3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/testthat/test-format_area.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
testthat::test_that("format_area works well", {

expect_error(format_area("a"))
triangle <- rbind(
c(-79.19, 35.6),
c(-79.19, 36.11),
c(-78.39, 36.11),
c(-78.39, 35.6)
) |>
terra::vect("polygons", crs = "epsg:4326")
expect_no_error(format_area(triangle))
expect_no_error(inherits(format_area(triangle), c("sf", "sfc")))
expect_no_error(format_area(format_area(triangle)))
x <- terra::rast(nrows = 10,
ncols = 10,
xmin = -79.19,
xmax = -78.39,
ymin = 35.6,
ymax = 36.11)
terra::values(x) <- 1:100
expect_no_error(format_area(x))
})

0 comments on commit 7f71ba3

Please sign in to comment.