wkt <- "POLYGON((13.26349675655365 52.53991761181831,18.36115300655365 54.11445544219924, 21.87677800655365 53.80418956368524,24.68927800655365 54.217364774722455,28.20490300655365 54.320018299365124,30.49005925655365 52.85948216284084,34.70880925655365 52.753220564427814, 35.93927800655365 50.46131871049754,39.63068425655365 49.55761261299145,40.86115300655365 46.381388009130845,34.00568425655365 45.279102926537,33.30255925655365 48.636868465271846, 30.13849675655365 49.78513301801265,28.38068425655365 47.2236377039631,29.78693425655365 44.6572866068524,27.67755925655365 42.62220075124676,23.10724675655365 43.77542058000212, 24.51349675655365 47.10412345120368,26.79865300655365 49.55761261299145,23.98615300655365 52.00209943876426,23.63459050655365 49.44345313705238,19.41584050655365 47.580567827212114, 19.59162175655365 44.90682206053508,20.11896550655365 42.36297154876359,22.93146550655365 40.651849782081555,25.56818425655365 39.98171166226459,29.61115300655365 40.78507856230178, 32.95099675655365 40.38459278067577,32.95099675655365 37.37491910393631,26.27130925655365 33.65619609886799,22.05255925655365 36.814081996401605,18.71271550655365 36.1072176729021, 18.53693425655365 39.16878677351903,15.37287175655365 38.346355762190846,15.19709050655365 41.578843777436326,12.56037175655365 41.050735748143424,12.56037175655365 44.02872991212046, 15.19709050655365 45.52594200494078,16.42755925655365 48.05271546733352,17.48224675655365 48.86865641518059,10.62677800655365 47.817178329053135,9.57209050655365 44.154980365192, 8.16584050655365 40.51835445724746,6.05646550655365 36.53210972067291,0.9588092565536499 31.583640057148145,-5.54509699344635 35.68001485298146,-6.77556574344635 40.51835445724746, -9.41228449344635 38.346355762190846,-12.40056574344635 35.10683619158607,-15.74040949344635 38.07010978950028,-14.68572199344635 41.31532459432774,-11.69744074344635 43.64836179231387, -8.88494074344635 42.88035509418534,-4.31462824344635 43.52103366008421,-8.35759699344635 47.2236377039631,-8.18181574344635 50.12441989397795,-5.01775324344635 49.55761261299145, -2.73259699344635 46.25998980446569,-1.67790949344635 44.154980365192,-1.32634699344635 39.30493590580802,2.18927800655365 41.44721797271696,4.47443425655365 43.26556960420879, 2.18927800655365 46.7439668697322,1.83771550655365 50.3492841273576,6.93537175655365 49.671505849335254,5.00177800655365 52.32557322466785,7.81427800655365 51.67627099802223, 7.81427800655365 54.5245591562317,10.97834050655365 51.89375191441792,10.97834050655365 55.43241335888528,13.26349675655365 52.53991761181831))" wkt <- gsub("\n", " ", wkt) test_that("wkt_parse", { # skip_on_ci() # skip because sf install too buggy skip_on_cran() # because fixture in .Rbuildignore skip_if_not_installed("sf") # geom_big=bbox aa <- wkt_parse(wkt, geom_big = "bbox") expect_is(aa, "character") expect_match(aa, "POLYGON") expect_equal(length(strextracta(aa, ",")), 4) # geom_big=axe bb <- wkt_parse(wkt, geom_big = "axe") expect_is(bb, "character") expect_equal(length(bb), 4) for (i in bb) expect_is(i, "character") for (i in bb) expect_match(i, "POLYGON") # geom_big=axe, geom_size=60 cc <- wkt_parse(wkt, geom_big = "axe", geom_size = 60) expect_is(cc, "character") expect_equal(length(cc), 1) for (i in cc) expect_is(i, "character") for (i in cc) expect_match(i, "POLYGON") # geom_big=axe, geom_size=5 dd <- wkt_parse(wkt, geom_big = "axe", geom_size = 5) expect_is(dd, "character") expect_equal(length(dd), 50) for (i in dd) expect_is(i, "character") for (i in dd) expect_match(i, "POLYGON") }) test_that("wkt_parse fails well", { expect_error(wkt_parse(wkt), "missing") expect_error(wkt_parse(wkt, 5), "must be one of") expect_error(wkt_parse(wkt, "bbox", geom_size = "adf"), "must be of class") expect_error(wkt_parse(wkt, "bbox", geom_n = "adf"), "must be of class") })