Skip to content

Commit

Permalink
feat: wip - add use case test case
Browse files Browse the repository at this point in the history
  • Loading branch information
RobWalt committed Jul 10, 2023
1 parent 7ddeb08 commit f7e0c2f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion geo/src/algorithm/bool_ops/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{LineString, MultiPolygon, Polygon};
use crate::{LineString, MapCoords, MultiPolygon, Polygon};
use log::{error, info};

use std::{
Expand Down Expand Up @@ -285,3 +285,27 @@ fn falliable_boolops_on_976_5() {
let err = a.try_intersection(&b).expect_err("should fail");
assert_eq!(err, GeoError::NotEulierian(1));
}

#[test]
fn falliable_boolops_on_976_1_usecase() {
init_log();
const DATA : &'static str = "
[{\"exterior\":[{\"x\":-9911.954,\"y\":-8725.639},{\"x\":-9915.633,\"y\":9687.057},{\"x\":-4963.603,\"y\":-45.043945},{\"x\":-9911.954,\"y\":-8725.639}],\"interiors\":[]},{\"exterior\":[{\"x\":-9007.182,\"y\":9094.508},{\"x\":-2687.1802,\"y\":-8199.999},{\"x\":-9915.442,\"y\":8069.0723},{\"x\":-9007.182,\"y\":9094.508}],\"interiors\":[]}]
";
let [a, b]: [Polygon<f32>; 2] = serde_json::from_str(&DATA).unwrap();
let err = a.try_intersection(&b).expect_err("should fail");
assert_eq!(err, GeoError::NotEulierian(1));

let a = a.map_coords(|c| geo_types::Coord {
x: c.x as f64,
y: c.y as f64,
});
let b = b.map_coords(|c| geo_types::Coord {
x: c.x as f64,
y: c.y as f64,
});
assert!(
a.try_intersection(&b).is_ok(),
"shouldnt fail anymore + program didn't crash"
);
}

0 comments on commit f7e0c2f

Please sign in to comment.