Skip to content

Commit

Permalink
Merge pull request #111 from jenetics/issues/JPX-110-tobounds
Browse files Browse the repository at this point in the history
#110: Fix 'Bound.toBounds()' method.
  • Loading branch information
jenetics authored Dec 30, 2019
2 parents 8f10524 + 88f911b commit 1c0c9a9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jpx/src/main/java/io/jenetics/jpx/Bounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ public String toString() {
final double[] a = new double[4];
a[0] = Double.MAX_VALUE;
a[1] = Double.MAX_VALUE;
a[2] = Double.MIN_VALUE;
a[3] = Double.MIN_VALUE;
a[2] = -Double.MAX_VALUE;
a[3] = -Double.MAX_VALUE;
return a;
},
(a, b) -> {
Expand Down
22 changes: 22 additions & 0 deletions jpx/src/test/java/io/jenetics/jpx/BoundsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,28 @@ public void toBounds() {
);
}

// https://github.com/jenetics/jpx/issues/110
@Test
public void toBoundsNegativeValues() {
final Stream<WayPoint> points = Stream.of(
WayPoint.of(-50, -100),
WayPoint.of(-51, -101),
WayPoint.of(-52, -102),
WayPoint.of(-53, -103),
WayPoint.of(-54, -104),
WayPoint.of(-55, -105)
);

final Bounds bounds = points.collect(Bounds.toBounds());
Assert.assertEquals(
bounds,
Bounds.of(
Latitude.ofDegrees(-55), Longitude.ofDegrees(-105),
Latitude.ofDegrees(-50), Longitude.ofDegrees(-100)
)
);
}

@Test
public void toBoundsForOnePoints() {
final Stream<WayPoint> points = Stream.of(
Expand Down

0 comments on commit 1c0c9a9

Please sign in to comment.