-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eva Marques
committed
Jun 6, 2024
1 parent
8dc19e9
commit 7f71ba3
Showing
1 changed file
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
}) | ||
|