vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java
brancharithmetic
changeset 680 7ffb635a5c4f
parent 676 eecf6077ec4e
child 698 ff57af563cb8
child 708 59d5596a9c6c
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Tue Feb 05 16:40:01 2013 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Wed Feb 06 12:46:35 2013 +0100
     1.3 @@ -649,7 +649,47 @@
     1.4              new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
     1.5          );
     1.6      }
     1.7 -    
     1.8 +
     1.9 +    @Test public void longCompareSameNumbers() throws Exception {
    1.10 +        assertExec("Long compare same numbers",
    1.11 +            Numbers.class, "compareL__I_3B_3BI",
    1.12 +            0.0,
    1.13 +            new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
    1.14 +            new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
    1.15 +            0
    1.16 +        );
    1.17 +    }
    1.18 +
    1.19 +    @Test public void longComparePositiveNumbers() throws Exception {
    1.20 +        assertExec("Long compare positive numbers",
    1.21 +            Numbers.class, "compareL__I_3B_3BI",
    1.22 +            -1.0,
    1.23 +            new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x00 },
    1.24 +            new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x10, (byte)0x00, (byte)0x00, (byte)0x00 },
    1.25 +            0
    1.26 +        );
    1.27 +    }
    1.28 +
    1.29 +    @Test public void longCompareNegativeNumbers() throws Exception {
    1.30 +        assertExec("Long compare negative numbers",
    1.31 +            Numbers.class, "compareL__I_3B_3BI",
    1.32 +            1.0,
    1.33 +            new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
    1.34 +            new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
    1.35 +            0
    1.36 +        );
    1.37 +    }
    1.38 +
    1.39 +    @Test public void longCompareMixedNumbers() throws Exception {
    1.40 +        assertExec("Long compare mixed numbers",
    1.41 +            Numbers.class, "compareL__I_3B_3BI",
    1.42 +            -1.0,
    1.43 +            new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
    1.44 +            new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
    1.45 +            0
    1.46 +        );
    1.47 +    }
    1.48 +
    1.49      private static CharSequence codeSeq;
    1.50      private static Invocable code;
    1.51