@@ -125,6 +125,8 @@ TEST(GeoParser, parseGeoJSONLine) {
125
125
fromjson (" {'type':'LineString', 'coordinates':[[1,2, 3], [3,4, 5], [5,6]]}" ),
126
126
false ,
127
127
&polyline));
128
+ ASSERT_NOT_OK (GeoParser::parseGeoJSONLine (
129
+ fromjson (" {'type':'LineString', 'coordinates':[[1,2], [1,2]]}" ), false , &polyline));
128
130
}
129
131
130
132
TEST (GeoParser, parseGeoJSONPolygon) {
@@ -220,6 +222,34 @@ TEST(GeoParser, parseGeoJSONPolygon) {
220
222
&polygonBad));
221
223
}
222
224
225
+ TEST (GeoParser, parseGeoJSONPolygonStrictSphere) {
226
+ string crs = " crs:{ type: 'name', properties:{name:'" + CRS_STRICT_WINDING + " '}}" ;
227
+ PolygonWithCRS polygon;
228
+ BSONObj bigSimplePolygon = fromjson (
229
+ " {'type':'Polygon', 'coordinates':[ "
230
+ " [[0,0],[5,0],[5,5],[0,5],[0,0]]], " +
231
+ crs + " }" );
232
+ ASSERT_OK (GeoParser::parseGeoJSONPolygon (bigSimplePolygon, false , &polygon));
233
+
234
+ BSONObj bigSimplePolygonWithValidDuplicates = fromjson (
235
+ " {'type':'Polygon', 'coordinates':[ "
236
+ " [[0,0],[5,0],[5,5],[5,5],[0,5],[0,0]]], " +
237
+ crs + " }" );
238
+ ASSERT_OK (GeoParser::parseGeoJSONPolygon (bigSimplePolygonWithValidDuplicates, false , &polygon));
239
+
240
+ BSONObj bigSimplePolygonWithInvalidDuplicates = fromjson (
241
+ " {'type':'Polygon', 'coordinates':[ "
242
+ " [[0,0],[5,0],[5,0],[0,0],[0,0]]], " +
243
+ crs + " }" );
244
+ ASSERT_NOT_OK (
245
+ GeoParser::parseGeoJSONPolygon (bigSimplePolygonWithInvalidDuplicates, false , &polygon));
246
+
247
+ BSONObj bigSimplePolygonWithFewPoints = fromjson (
248
+ " {'type':'Polygon', 'coordinates':[ "
249
+ " [[0,0]]], " +
250
+ crs + " }" );
251
+ ASSERT_NOT_OK (GeoParser::parseGeoJSONPolygon (bigSimplePolygonWithFewPoints, false , &polygon));
252
+ }
223
253
224
254
TEST (GeoParser, parseGeoJSONCRS) {
225
255
string goodCRS1 = " crs:{ type: 'name', properties:{name:'EPSG:4326'}}" ;
0 commit comments