tests/testthat/test-btb_add_inspire.R

test_that("btb_add_inspire works !", {
  
  
  # Test normal behaviour
  pts_centro1 <- pixel_france[1:1000,] 
  
  testthat::expect_true(
    is.data.frame(
      btb::btb_add_inspire(pts_centro1, iCellSize = 1000, sEPSG = "2154",names_centro = c("x","y"))
    )
  )
  
  pts_centro2 <- data.frame(x_centro=c(150,350,550,150,350,550),y_centro=c(175,175,175,375,375,375))
  testthat::expect_true(
    is.data.frame(
      btb::btb_add_inspire(pts_centro2, iCellSize = 200, sEPSG = "2154")
    )
  )
  
  # Test error if points don't represent centroids
  # pts1 <- btb::dfRestaurantParis
  # testthat::expect_error(
  #   btb::btb_add_inspire(pts1, iCellSize = 200,sEPSG = "2154", names_centro = c("x","y"))
  # )
  
  
})

Try the btb package in your browser

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

btb documentation built on Oct. 24, 2022, 5:10 p.m.