Skip to content

Commit

Permalink
Reduce float precision, restrict CI to branches
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Feb 22, 2022
1 parent 4fcd6ee commit a0529a9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
on:
push:
branches:
- main
- master
- staging
- trying
pull_request:
schedule: [cron: "45 6 * * *"]

name: Run tests
Expand Down
3 changes: 1 addition & 2 deletions geo/src/algorithm/closest_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ impl<F: GeoFloat> ClosestPoint<F> for Geometry<F> {

#[cfg(test)]
mod tests {
#![allow(clippy::excessive_precision)]
use super::*;
use crate::{point, polygon};

Expand Down Expand Up @@ -278,7 +277,7 @@ mod tests {
#[test]
fn polygon_without_rings_and_point_outside_is_same_as_linestring() {
let poly = holy_polygon();
let p = Point::new(1000.0, 12345.6789);
let p = Point::new(1000.0, 12345.678);
assert!(
!poly.exterior().contains(&p),
"`p` should be outside the polygon!"
Expand Down
5 changes: 2 additions & 3 deletions geo/src/algorithm/haversine_distance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ where

#[cfg(test)]
mod test {
#![allow(clippy::excessive_precision)]
use crate::algorithm::haversine_distance::HaversineDistance;
use crate::Point;

Expand Down Expand Up @@ -99,8 +98,8 @@ mod test {
#[test]
fn distance3_test_f32() {
// this input comes from issue #100
let a = Point::<f32>::new(-77.036585, 38.897448);
let b = Point::<f32>::new(-77.009080, 38.889825);
let a = Point::<f32>::new(-77.03658, 38.89745);
let b = Point::<f32>::new(-77.00908, 38.889825);
assert_relative_eq!(a.haversine_distance(&b), 2526.8354_f32, epsilon = 1.0e-6);
}
}
5 changes: 2 additions & 3 deletions geo/src/algorithm/line_intersection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ fn proper_intersection<F: GeoFloat>(p: Line<F>, q: Line<F>) -> Coordinate<F> {

#[cfg(test)]
mod test {
#![allow(clippy::excessive_precision)]
use super::*;

/// Based on JTS test `testCentralEndpointHeuristicFailure`
Expand Down Expand Up @@ -539,7 +538,7 @@ mod test {
let line_1 = Line::new(
Coordinate {
x: 2089426.5233462777,
y: 1180182.3877339689,
y: 1180182.387733969,
},
Coordinate {
x: 2085646.6891757075,
Expand All @@ -552,7 +551,7 @@ mod test {
y: 1997547.0560044837,
},
Coordinate {
x: 2259977.3672235999,
x: 2259977.3672236,
y: 483675.17050843034,
},
);
Expand Down
17 changes: 8 additions & 9 deletions geo/src/algorithm/rotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ where

#[cfg(test)]
mod test {
#![allow(clippy::excessive_precision)]
use super::*;
use crate::{line_string, point, polygon, Coordinate, Point};
use approx::assert_relative_eq;
Expand Down Expand Up @@ -657,16 +656,16 @@ mod test {
let expected_centroid: MultiPolygon<f64> = vec![
polygon![
(x: 0., y: 0.),
(x: 7.0710678118654755, y: 7.0710678118654746),
(x: 0., y: 14.1421356237309510),
(x: -7.0710678118654746, y: 7.0710678118654755),
(x: 7.0710678118654755, y: 7.071067811865475),
(x: 0., y: 14.142135623730951),
(x: -7.071067811865475, y: 7.0710678118654755),
(x: 0., y: 0.),
],
polygon![
(x: 0., y: 0.),
(x: -7.0710678118654755, y: -7.0710678118654746),
(x: 0., y: -14.1421356237309510),
(x: 7.0710678118654746, y: -7.0710678118654755),
(x: -7.0710678118654755, y: -7.071067811865475),
(x: 0., y: -14.142135623730951),
(x: 7.071067811865475, y: -7.0710678118654755),
(x: 0., y: 0.),
],
]
Expand Down Expand Up @@ -728,11 +727,11 @@ mod test {
(x: -0.1016007672888048, y: 3.05186627999456),
],
polygon![
(x: 8.591731669312811, y: 0.7224948740718733),
(x: 8.59173166931281, y: 0.7224948740718733),
(x: 10.52358332189095, y: 0.2048567838668318),
(x: 13.37059281801868, y: 10.83004087304658),
(x: 11.43874116544054, y: 11.34767896325162),
(x: 8.591731669312811, y: 0.7224948740718733),
(x: 8.59173166931281, y: 0.7224948740718733),
],
]
.into();
Expand Down

0 comments on commit a0529a9

Please sign in to comment.