vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java
brancharithmetic
changeset 620 189f695d0b02
parent 618 171fa0ca3add
child 627 4c2b92281cdc
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Thu Jan 31 13:59:34 2013 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Thu Jan 31 15:26:09 2013 +0100
     1.3 @@ -171,6 +171,36 @@
     1.4          );
     1.5      }
     1.6      
     1.7 +    @Test public void longSubUnderflow() throws Exception {
     1.8 +        final long res = Long.MIN_VALUE - 1l;
     1.9 +        assertExec("Subtraction MIN-1",
    1.10 +            Numbers.class, "subL__J_3B_3B", 
    1.11 +            Double.valueOf(res),
    1.12 +                new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
    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 longSubMinAndMin() throws Exception {
    1.18 +        final long res = Long.MIN_VALUE - Long.MIN_VALUE;
    1.19 +        assertExec("Subtraction MIN-MIN",
    1.20 +            Numbers.class, "subL__J_3B_3B", 
    1.21 +            Double.valueOf(res),
    1.22 +            new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
    1.23 +            new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }
    1.24 +        );
    1.25 +    }
    1.26 +    
    1.27 +    @Test public void longSubMinAndMax() throws Exception {
    1.28 +        final long res = Long.MIN_VALUE - Long.MAX_VALUE;
    1.29 +        assertExec("Subtraction MIN-MAX",
    1.30 +            Numbers.class, "subL__J_3B_3B", 
    1.31 +            Double.valueOf(res),
    1.32 +            new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
    1.33 +            new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff }
    1.34 +        );
    1.35 +    }
    1.36 +    
    1.37      @Test public void longShiftL1() throws Exception {
    1.38          final long res = 0x00fa37d7763e0ca1l << 5;
    1.39          assertExec("Long << 5",