1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Wed Jan 30 22:23:21 2013 +0100
1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Thu Jan 31 13:42:14 2013 +0100
1.3 @@ -151,6 +151,26 @@
1.4 );
1.5 }
1.6
1.7 + @Test public void longAddOverflow() throws Exception {
1.8 + final long res = Long.MAX_VALUE + 1l;
1.9 + assertExec("Addition 1+MAX",
1.10 + Numbers.class, "addL__J_3B_3B",
1.11 + Double.valueOf(res),
1.12 + new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.13 + new byte[] { (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)1 }
1.14 + );
1.15 + }
1.16 +
1.17 + @Test public void longAddMaxAndMax() throws Exception {
1.18 + final long res = Long.MAX_VALUE + Long.MAX_VALUE;
1.19 + assertExec("Addition MAX+MAX",
1.20 + Numbers.class, "addL__J_3B_3B",
1.21 + Double.valueOf(res),
1.22 + new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.23 + new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff }
1.24 + );
1.25 + }
1.26 +
1.27 private static CharSequence codeSeq;
1.28 private static Invocable code;
1.29
1.30 @@ -173,10 +193,11 @@
1.31 if (expRes instanceof Double && ret instanceof Double) {
1.32 double expD = ((Double)expRes).doubleValue();
1.33 double retD = ((Double)ret).doubleValue();
1.34 - assertEquals(retD, expD, 0.000004, msg + " was " + ret + "\n" + StaticMethodTest.dumpJS(codeSeq));
1.35 + assertEquals(retD, expD, 0.000004, msg + " "
1.36 + + StaticMethodTest.dumpJS(codeSeq));
1.37 return;
1.38 }
1.39 - assertEquals(ret, expRes, msg + "was: " + ret + "\n" + StaticMethodTest.dumpJS(codeSeq));
1.40 + assertEquals(ret, expRes, msg + " " + StaticMethodTest.dumpJS(codeSeq));
1.41 }
1.42
1.43 }