()
| 259 | |
| 260 | #[test] |
| 261 | fn contained_square() { |
| 262 | let a = square(0.0, 10.0); |
| 263 | let b = square(2.0, 8.0); |
| 264 | let result = st_intersection(&a, &b); |
| 265 | if let Geometry::Polygon { coordinates } = &result { |
| 266 | // Result should be approximately b itself. |
| 267 | let xs: Vec<f64> = coordinates[0].iter().map(|c| c[0]).collect(); |
| 268 | let min_x = xs.iter().cloned().fold(f64::INFINITY, f64::min); |
| 269 | let max_x = xs.iter().cloned().fold(f64::NEG_INFINITY, f64::max); |
| 270 | assert!((min_x - 2.0).abs() < 0.01); |
| 271 | assert!((max_x - 8.0).abs() < 0.01); |
| 272 | } else { |
| 273 | panic!("expected Polygon"); |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | #[test] |
| 278 | fn disjoint_returns_empty() { |
nothing calls this directly
no test coverage detected