Add proximity test.

This commit is contained in:
Tormod G. Hellen 2023-05-16 16:48:28 +02:00
parent 1572a5a759
commit 2397209b5d
No known key found for this signature in database
GPG Key ID: 13F76F45CB334E5B

View File

@ -1914,6 +1914,16 @@ mod tests {
assert!(!reqs.satisfied_by(Vec2 { x: -8, y: 8 }));
}
#[test]
fn complex_proximity_requirements() {
let a_site = Vec2 { x: 572, y: 724 };
let reqs = ProximityRequirements::new()
.close_to_one_of(vec![a_site].into_iter(), 60)
.avoid_all_of(vec![a_site].into_iter(), 40);
assert!(reqs.satisfied_by(Vec2 { x: 572, y: 774 }));
assert!(!reqs.satisfied_by(a_site));
}
#[test]
fn location_hint() {
let reqs = ProximityRequirements::new().close_to_one_of(