<Rcpp::index_out_of_bounds/C++Error/error/condition>
Error: Index out of bounds: [index='prob0'].

test_that("gaussian returns correct format", {
env <- terra::scale(env) #Note: this line causes an error without the explicit call to terra
pres <- get_env_pres(coords = occurrences,
out <- S4DM:::pnp_gaussian(data = pres$env,method = "fit")
expect_equal(object = length(out),expected = 3)
expect_s3_class(object = out, class = "pnp_estimate")
out2 <- S4DM:::pnp_gaussian(data = bg$env,method = "predict",object = out)
expect_equal(object = length(out2),expected = nrow(bg$env))
test_that("kde returns correct format", {
out <- S4DM:::pnp_kde(data = pres$env,method = "fit")
out2 <- S4DM:::pnp_kde(data = bg$env,method = "predict",object = out)
test_that("lobagoc returns correct format", {
out <- S4DM:::pnp_lobagoc(data = pres$env,method = "fit")
expect_equal(object = length(out),expected = 2)
out2 <- S4DM:::pnp_lobagoc(data = bg$env,method = "predict",object = out)
test_that("rangebagging returns correct format", {
out <- S4DM:::pnp_rangebagging(data = pres$env,method = "fit")
out2 <- S4DM:::pnp_rangebagging(data = bg$env,method = "predict",object = out)
test_that("vine returns correct format", {
out <- S4DM:::pnp_vine(data = pres$env,method = "fit")
out2 <- S4DM:::pnp_vine(data = bg$env,method = "predict",object = out)
test_that("none returns correct format", {
out <- S4DM:::pnp_none(data = pres$env,method = "fit")
expect_equal(object = length(out),expected = 1)
out2 <- S4DM:::pnp_none(data = bg$env,method = "predict",object = out)
expect_equal(object = length(out2),expected = 0)

#Note: this line causes an error without the explicit call to terra