Skip to content

Commit

Permalink
better boundingrect test
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Dec 18, 2020
1 parent ac4fe4a commit 9de3748
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion geo/fuzz/fuzz_targets/bounding_rect.rs
@@ -1,8 +1,18 @@
#![no_main]

use geo::algorithm::bounding_rect::BoundingRect;
use geo::algorithm::contains::Contains;
use geo::algorithm::intersects::Intersects;
use geo::algorithm::coords_iter::CoordsIter;
use libfuzzer_sys::fuzz_target;

fuzz_target!(|geometry: geo::Geometry<f32>| {
geometry.bounding_rect();
let rect = match geometry.bounding_rect() {
Some(r) => r,
None => return,
};

for coord in geometry.coords_iter() {
assert!(rect.contains(&coord) || rect.intersects(&coord));
}
});

0 comments on commit 9de3748

Please sign in to comment.