# Generated by fusen: do not edit by hand
library(testthat)
library(dplyr)
test_that("extract_map works", {
expect_true(inherits(extract_map, "function"))
})
test_that("test conformite simulate_ind", {
data("dataset_density")
test <- dataset_density %>%
extract_map(N = 500,
crs = 2154) %>%
slice(1:5)
exp <- structure(list(strata = c("St Andrews bay", "St Andrews bay",
"St Andrews bay", "St Andrews bay", "St Andrews bay"), density = c(10.5870697722385,
10.0915244093542, 9.45666871410529, 8.74640906414673, 8.02399470530445
), x = c(-159390.409885506, -157390.409885506, -155390.409885506,
-153390.409885506, -151390.409885506), y = c(6244043.1524534,
6244043.1524534, 6244043.1524534, 6244043.1524534, 6244043.1524534
), area = c(4e+06, 4e+06, 4e+06, 4e+06, 4e+06), area_grid = c(4e+06,
4e+06, 4e+06, 4e+06, 4e+06), density_m = c(1.1143756163953e-06,
1.06221541710539e-06, 9.95391666819911e-07, 9.20631034062134e-07,
8.44591018859943e-07), density_km = c(1.1143756163953, 1.06221541710539,
0.995391666819911, 0.920631034062134, 0.844591018859943), geometry = structure(list(
structure(list(structure(c(-160390.409885506, -160390.409885506,
-158390.409885506, -158390.409885506, -160390.409885506,
6243043.1524534, 6245043.1524534, 6245043.1524534, 6243043.1524534,
6243043.1524534), .Dim = c(5L, 2L))), class = c("XY", "POLYGON",
"sfg")), structure(list(structure(c(-158390.409885506, -158390.409885506,
-156390.409885506, -156390.409885506, -158390.409885506,
6243043.1524534, 6245043.1524534, 6245043.1524534, 6243043.1524534,
6243043.1524534), .Dim = c(5L, 2L))), class = c("XY", "POLYGON",
"sfg")), structure(list(structure(c(-156390.409885506, -156390.409885506,
-154390.409885506, -154390.409885506, -156390.409885506,
6243043.1524534, 6245043.1524534, 6245043.1524534, 6243043.1524534,
6243043.1524534), .Dim = c(5L, 2L))), class = c("XY", "POLYGON",
"sfg")), structure(list(structure(c(-154390.409885506, -154390.409885506,
-152390.409885506, -152390.409885506, -154390.409885506,
6243043.1524534, 6245043.1524534, 6245043.1524534, 6243043.1524534,
6243043.1524534), .Dim = c(5L, 2L))), class = c("XY", "POLYGON",
"sfg")), structure(list(structure(c(-152390.409885506, -152390.409885506,
-150390.409885506, -150390.409885506, -152390.409885506,
6243043.1524534, 6245043.1524534, 6245043.1524534, 6243043.1524534,
6243043.1524534), .Dim = c(5L, 2L))), class = c("XY", "POLYGON",
"sfg"))), class = c("sfc_POLYGON", "sfc"), precision = 0, bbox = structure(c(xmin = -160390.409885506,
ymin = 6243043.1524534, xmax = -150390.409885506, ymax = 6245043.1524534
), class = "bbox"), crs = structure(list(input = "EPSG:2154",
wkt = "PROJCRS[\"RGF93 / Lambert-93\",\n BASEGEOGCRS[\"RGF93\",\n DATUM[\"Reseau Geodesique Francais 1993\",\n ELLIPSOID[\"GRS 1980\",6378137,298.257222101,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n ID[\"EPSG\",4171]],\n CONVERSION[\"Lambert-93\",\n METHOD[\"Lambert Conic Conformal (2SP)\",\n ID[\"EPSG\",9802]],\n PARAMETER[\"Latitude of false origin\",46.5,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8821]],\n PARAMETER[\"Longitude of false origin\",3,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8822]],\n PARAMETER[\"Latitude of 1st standard parallel\",49,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8823]],\n PARAMETER[\"Latitude of 2nd standard parallel\",44,\n ANGLEUNIT[\"degree\",0.0174532925199433],\n ID[\"EPSG\",8824]],\n PARAMETER[\"Easting at false origin\",700000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8826]],\n PARAMETER[\"Northing at false origin\",6600000,\n LENGTHUNIT[\"metre\",1],\n ID[\"EPSG\",8827]]],\n CS[Cartesian,2],\n AXIS[\"easting (X)\",east,\n ORDER[1],\n LENGTHUNIT[\"metre\",1]],\n AXIS[\"northing (Y)\",north,\n ORDER[2],\n LENGTHUNIT[\"metre\",1]],\n USAGE[\n SCOPE[\"unknown\"],\n AREA[\"France\"],\n BBOX[41.15,-9.86,51.56,10.38]],\n ID[\"EPSG\",2154]]"), class = "crs"), n_empty = 0L)), row.names = c(NA,
-5L), class = c("sf", "data.frame"), sf_column = "geometry", agr = structure(c(strata = NA_integer_,
density = NA_integer_, x = NA_integer_, y = NA_integer_, area = NA_integer_,
area_grid = NA_integer_, density_m = NA_integer_, density_km = NA_integer_
), class = "factor", .Label = c("constant", "aggregate", "identity"
)))
expect_equal(object = test,
expected = exp)
expect_is(test, "data.frame")
})
test_that("test erreur extract_map", {
data(iris)
expect_error(object = extract_map(density_obj = iris,
N = 500,
crs = 2154))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.