Skip to content

Commit

Permalink
adapt to new geos test output
Browse files Browse the repository at this point in the history
Looks like they cleaned up their wkt output to remove trailing .0's
  • Loading branch information
michaelkirk committed Dec 13, 2024
1 parent 11cb861 commit 6845688
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions geozero/src/geos/geos_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ mod test {
#[test]
fn point_geom() {
let geojson = r#"{"type": "Point", "coordinates": [1, 1]}"#;
let wkt = "POINT (1.0000000000000000 1.0000000000000000)";
let wkt = "POINT (1 1)";
let mut geos = GeosWriter::new();
assert!(read_geojson(geojson.as_bytes(), &mut geos).is_ok());
assert_eq!(geos.geometry().to_wkt().unwrap(), wkt);
Expand All @@ -192,15 +192,15 @@ mod test {
#[test]
fn multipoint_geom() {
let geojson = GeoJson(r#"{"type": "MultiPoint", "coordinates": [[1, 1], [2, 2]]}"#);
let wkt = "MULTIPOINT (1.0000000000000000 1.0000000000000000, 2.0000000000000000 2.0000000000000000)";
let wkt = "MULTIPOINT ((1 1), (2 2))";
let geos = geojson.to_geos().unwrap();
assert_eq!(geos.to_wkt().unwrap(), wkt);
}

#[test]
fn line_geom() {
let geojson = GeoJson(r#"{"type": "LineString", "coordinates": [[1,1], [2,2]]}"#);
let wkt = "LINESTRING (1.0000000000000000 1.0000000000000000, 2.0000000000000000 2.0000000000000000)";
let wkt = "LINESTRING (1 1, 2 2)";
let geos = geojson.to_geos().unwrap();
assert_eq!(geos.to_wkt().unwrap(), wkt);
}
Expand All @@ -217,7 +217,7 @@ mod test {
fn multiline_geom() {
let geojson =
GeoJson(r#"{"type": "MultiLineString", "coordinates": [[[1,1],[2,2]],[[3,3],[4,4]]]}"#);
let wkt = "MULTILINESTRING ((1.0000000000000000 1.0000000000000000, 2.0000000000000000 2.0000000000000000), (3.0000000000000000 3.0000000000000000, 4.0000000000000000 4.0000000000000000))";
let wkt = "MULTILINESTRING ((1 1, 2 2), (3 3, 4 4))";
let geos = geojson.to_geos().unwrap();
assert_eq!(geos.to_wkt().unwrap(), wkt);
}
Expand All @@ -233,7 +233,7 @@ mod test {
]]
}"#;
let geojson = GeoJson(geojson);
let wkt = "POLYGON ((0.0000000000000000 0.0000000000000000, 0.0000000000000000 3.0000000000000000, 3.0000000000000000 3.0000000000000000, 3.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.2000000000000000 0.2000000000000000, 0.2000000000000000 2.0000000000000000, 2.0000000000000000 2.0000000000000000, 2.0000000000000000 0.2000000000000000, 0.2000000000000000 0.2000000000000000))";
let wkt = "POLYGON ((0 0, 0 3, 3 3, 3 0, 0 0), (0.2 0.2, 0.2 2, 2 2, 2 0.2, 0.2 0.2))";
let geos = geojson.to_geos().unwrap();
assert_eq!(geos.to_wkt().unwrap(), wkt);
}
Expand All @@ -247,7 +247,7 @@ mod test {
]]]
}"#;
let geojson = GeoJson(geojson);
let wkt = "MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000)))";
let wkt = "MULTIPOLYGON (((0 0, 0 1, 1 1, 1 0, 0 0)))";
let geos = geojson.to_geos().unwrap();
assert_eq!(geos.to_wkt().unwrap(), wkt);
}
Expand All @@ -269,7 +269,7 @@ mod test {
let geos = geo.to_geos()?;
assert_eq!(
&geos.to_wkt().unwrap(),
"POINT (10.0000000000000000 20.0000000000000000)"
"POINT (10 20)"
);
Ok(())
}
Expand Down

0 comments on commit 6845688

Please sign in to comment.