-
-
Notifications
You must be signed in to change notification settings - Fork 528
Open
Description
Hi,
I made the following proptest strategy:
use nalgebra::Unit;
use nalgebra::proptest::vector;
use proptest::prelude::*;
fn arbitrary_unit_vector() -> impl Strategy<Value = Unit<Vector3<f64>>> {
any::<Vector3<f64>>()
.prop_filter("Non-zero vector", |v| v.norm() > 0.5)
.prop_map(|v| Unit::new_normalize(v))
}
Which I then use as follows:
#[test]
fn test_parametric_line_intersection(
intersection_point in arbitrary_point(),
v1 in arbitrary_unit_vector(),
v2 in arbitrary_unit_vector(),
min1 in -10.0 .. 0.0,
max1 in 0.0 .. 10.0,
min2 in -10.0 .. 0.0,
max2 in 0.0 .. 10.0,
)
Resulting in the error:
Test failed: assertion failed: v2.norm() > 0.5.
minimal failing input: intersection_point = [
0.0,
0.0,
0.0,
], v1 = [
[
0.0,
0.0,
-1.0,
],
], v2 = [
[
-0.0,
0.0,
0.0,
],
], min1 = 0.0, max1 = 0.0, min2 = 0.0, max2 = 0.0
successes: 0
local rejects: 0
global rejects: 0
thread 'geometry::intersection::tests::test_parametric_line_intersection' panicked at src/geometry/intersection.rs:178:13:
assertion failed: v1.norm() > 0.5
Note how v2 has 0 norm, and a negative x-component, despite being wrapped in Unit.
Metadata
Metadata
Assignees
Labels
No labels