From 9c1c06ad57937f0f3add3779cc46e597cb76803a Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 25 Feb 2016 17:50:41 +0000 Subject: [PATCH] Add StrictMath.round tests for large integers. This is a follow-up to https://android-review.googlesource.com/203175 . Bug: 27166445 Change-Id: I850999c782017650017fad7e27c83b60b57edaf9 --- test/082-inline-execute/src/Main.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/082-inline-execute/src/Main.java b/test/082-inline-execute/src/Main.java index 5b3fa1407..93a9005fe 100644 --- a/test/082-inline-execute/src/Main.java +++ b/test/082-inline-execute/src/Main.java @@ -1039,6 +1039,7 @@ public class Main { Assert.assertEquals(StrictMath.round(-2.9d), -3l); Assert.assertEquals(StrictMath.round(-3.0d), -3l); Assert.assertEquals(StrictMath.round(0.49999999999999994d), 0l); + Assert.assertEquals(StrictMath.round(9007199254740991.0d), 9007199254740991l); // 2^53 - 1 Assert.assertEquals(StrictMath.round(Double.NaN), (long)+0.0d); Assert.assertEquals(StrictMath.round(Long.MAX_VALUE + 1.0d), Long.MAX_VALUE); Assert.assertEquals(StrictMath.round(Long.MIN_VALUE - 1.0d), Long.MIN_VALUE); @@ -1062,6 +1063,7 @@ public class Main { Assert.assertEquals(StrictMath.round(-3.0f), -3); // 0.4999999701976776123046875 Assert.assertEquals(StrictMath.round(Float.intBitsToFloat(0x3EFFFFFF)), (int)+0.0f); + Assert.assertEquals(StrictMath.round(16777215.0f), 16777215); // 2^24 - 1 Assert.assertEquals(StrictMath.round(Float.NaN), (int)+0.0f); Assert.assertEquals(StrictMath.round(Integer.MAX_VALUE + 1.0f), Integer.MAX_VALUE); Assert.assertEquals(StrictMath.round(Integer.MIN_VALUE - 1.0f), Integer.MIN_VALUE); -- 2.11.0