From df9ff941a21d784de27476a4d9d02927a5405024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Varga?= Date: Wed, 14 Jun 2023 19:22:26 +0200 Subject: [PATCH] Reproduce fake line overlap issue --- tests/simple_test_1.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/simple_test_1.rs b/tests/simple_test_1.rs index b8194a0..95645c3 100644 --- a/tests/simple_test_1.rs +++ b/tests/simple_test_1.rs @@ -64,6 +64,31 @@ fn two_connected_3() -> Result<(), intersect2d::IntersectError> { Ok(()) } + +#[test] +fn two_connected_4() -> Result<(), intersect2d::IntersectError> { + let intersection = intersect( + &geo::Line::new( + geo::Coordinate{ x: 0.0, y: 0.0 }, + geo::Coordinate{ x: 0.0, y: 100.0 }, + ), + &geo::Line::new( + geo::Coordinate{ x: 0.0, y: 100.0 }, + geo::Coordinate{ x: 0.0, y: 200.0 }, + ), + ); + println!("intersection: {:?}", intersection); + assert!( + matches!( + intersection.expect("lines should intersect"), + intersect2d::Intersection::Intersection(coord) + if coord == geo::Coordinate{ x: 0.0, y: 100.0 } + ) + ); + Ok(()) +} + + //#[ignore] #[test] fn connected_3_1() -> Result<(), intersect2d::IntersectError> {