@@ -17,7 +17,7 @@ test_that("CPL_geos_is_valid works", {
1717
1818test_that(" geos ops give warnings and errors on longlat" , {
1919 skip_if_not_installed(" lwgeom" )
20- skip_if_not( ! sf_use_s2())
20+ skip_if( sf_use_s2())
2121
2222 nc = st_read(system.file(" shape/nc.shp" , package = " sf" ), quiet = TRUE )
2323 x = nc [1 : 2 ,]
@@ -92,9 +92,9 @@ test_that("geom operations work on sfg or sfc or sf", {
9292 expect_s3_class(st_boundary(gpnc ), " sfc_MULTILINESTRING" )
9393 expect_s3_class(st_boundary(gpnc [[1L ]]), " MULTILINESTRING" )
9494
95- expect_true(inherits( st_convex_hull(pnc )$ geometry , " sfc_POLYGON" ) )
96- expect_true(inherits( st_convex_hull(gpnc ), " sfc_POLYGON" ) )
97- expect_true(inherits( st_convex_hull(gpnc [[1L ]]), " POLYGON" ) )
95+ expect_s3_class( st_convex_hull(pnc )$ geometry , " sfc_POLYGON" )
96+ expect_s3_class( st_convex_hull(gpnc ), " sfc_POLYGON" )
97+ expect_s3_class( st_convex_hull(gpnc [[1L ]]), " POLYGON" )
9898
9999 expect_silent(st_simplify(pnc , FALSE , 1e4 ))
100100 expect_silent(st_simplify(gpnc , FALSE , 1e4 ))
@@ -172,7 +172,7 @@ test_that("st_difference works with partially overlapping geometries", {
172172 pl3 = st_polygon(list (matrix (c(0 , 1.25 , 2 , 1.25 , 1 , 2.5 , 0 , 1.25 ), byrow = TRUE , ncol = 2 )))
173173 in1 = st_sfc(list (pl1 , pl2 , pl3 ))
174174 in2 = st_sf(order = c(" A" , " B" , " C" ), geometry = st_sfc(list (pl1 , pl2 , pl3 ), crs = 4326 ), agr = " constant" )
175- if (package_version(gsub(" [a-zA-Z]" , " " , sf_extSoftVersion()[" GEOS" ])) < " 3.9.0" ) {
175+ if (package_version(gsub(" [a-zA-Z]" , " " , sf_extSoftVersion()[[ " GEOS" ] ])) < " 3.9.0" ) {
176176 correct_geom = st_sfc(list (
177177 st_polygon(list (matrix (c(0 , 2 , 1 , 0 , 0 , 0 , 1 , 0 ), ncol = 2 ))),
178178 st_polygon(list (matrix (c(0.5 , 0 , 1 , 2 , 1.5 , 1 , 0.5 , 0.5 , 0.5 , 1.5 , 0.5 , 0.5 , 1 , 0.5 ), ncol = 2 ))),
@@ -198,7 +198,7 @@ test_that("st_difference works with partially overlapping geometries", {
198198 expect_equal(attr(out1 , " crs" ), attr(in1 , " crs" ))
199199 expect_equal(st_crs(out2 ), st_crs(in2 ))
200200 # check that output geometries are actually correct
201- expect_equal(length( out1 ) , 3 )
201+ expect_length( out1 , 3 )
202202 expect_equal(nrow(out2 ), 3 )
203203 expect_equal(out1 [[1 ]][[1 ]], correct_geom [[1 ]][[1 ]])
204204 expect_equal(out1 [[2 ]][[1 ]], correct_geom [[2 ]][[1 ]])
@@ -228,8 +228,8 @@ test_that("st_difference works with fully contained geometries", {
228228 expect_equal(attr(out1 , " crs" ), attr(in1 , " crs" ))
229229 expect_equal(st_crs(out2 ), st_crs(in2 ))
230230 # check that output geometries are actually correct
231- expect_equal(length( out1 ) , 2 )
232- expect_equal(length( out2 ) , 2 )
231+ expect_length( out1 , 2 )
232+ expect_length( out2 , 2 )
233233 expect_equal(out1 [[1 ]][[1 ]], correct_geom [[1 ]][[1 ]])
234234 # expect_equal(out1[[2]][[1]], correct_geom[[2]][[1]])
235235 # expect_equal(out2[[1]][[1]], correct_geom[[1]][[1]])
@@ -257,5 +257,5 @@ test_that("binary operations work on sf objects with common column names", {
257257
258258test_that(" binary operations on empty sfg objects return NA" , {
259259 x = st_point() == st_linestring()
260- expect_true(is.na( x ) )
260+ expect_equal( x , NA )
261261})
0 commit comments