Skip to content

Commit 6556c7f

Browse files
committed
Change test value to get around Java 8 bug
Fixes issue iipc#31 which relates to changes in how Java rounds doubles in some edge cases.
1 parent 5d93656 commit 6556c7f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/test/java/org/archive/util/ArchiveUtilsTest.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -229,16 +229,19 @@ public void testByteArrayEquals() {
229229

230230
/** test doubleToString() */
231231
public void testDoubleToString(){
232-
double test = 12.345;
233-
assertTrue(
232+
double test = 12.121d;
233+
assertEquals(
234234
"cecking zero precision",
235-
ArchiveUtils.doubleToString(test, 0).equals("12"));
236-
assertTrue(
235+
"12",
236+
ArchiveUtils.doubleToString(test, 0));
237+
assertEquals(
237238
"cecking 2 character precision",
238-
ArchiveUtils.doubleToString(test, 2).equals("12.34"));
239-
assertTrue(
239+
"12.12",
240+
ArchiveUtils.doubleToString(test, 2));
241+
assertEquals(
240242
"cecking precision higher then the double has",
241-
ArchiveUtils.doubleToString(test, 65).equals("12.345"));
243+
"12.121",
244+
ArchiveUtils.doubleToString(test, 65));
242245
}
243246

244247

0 commit comments

Comments
 (0)