Added tests for Long >> arithmetic
authorMartin Soch <Martin.Soch@oracle.com>
Thu, 31 Jan 2013 13:59:34 +0100
brancharithmetic
changeset 618171fa0ca3add
parent 617 960e219425e2
child 619 5134b1d78432
Added tests for Long >>
vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java
     1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Thu Jan 31 13:55:12 2013 +0100
     1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java	Thu Jan 31 13:59:34 2013 +0100
     1.3 @@ -173,32 +173,56 @@
     1.4      
     1.5      @Test public void longShiftL1() throws Exception {
     1.6          final long res = 0x00fa37d7763e0ca1l << 5;
     1.7 -        assertExec("Long MAX",
     1.8 +        assertExec("Long << 5",
     1.9              Numbers.class, "shlL__J_3BI", 
    1.10              Double.valueOf(res),
    1.11                  new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
    1.12 -                5
    1.13 -        );
    1.14 +                5);
    1.15      }
    1.16      
    1.17      @Test public void longShiftL2() throws Exception {
    1.18          final long res = 0x00fa37d7763e0ca1l << 32;
    1.19 -        assertExec("Long MAX",
    1.20 +        assertExec("Long << 32",
    1.21              Numbers.class, "shlL__J_3BI", 
    1.22              Double.valueOf(res),
    1.23                  new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
    1.24 -                32
    1.25 -        );
    1.26 +                32);
    1.27      }
    1.28      
    1.29      @Test public void longShiftL3() throws Exception {
    1.30          final long res = 0x00fa37d7763e0ca1l << 45;
    1.31 -        assertExec("Long MAX",
    1.32 +        assertExec("Long << 45",
    1.33              Numbers.class, "shlL__J_3BI", 
    1.34              Double.valueOf(res),
    1.35                  new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
    1.36 -                45
    1.37 -        );
    1.38 +                45);
    1.39 +    }
    1.40 +    
    1.41 +    @Test public void longShiftR1() throws Exception {
    1.42 +        final long res = 0x00fa37d7763e0ca1l >> 5;
    1.43 +        assertExec("Long >> 5",
    1.44 +            Numbers.class, "shrL__J_3BI", 
    1.45 +            Double.valueOf(res),
    1.46 +                new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
    1.47 +                5);
    1.48 +    }
    1.49 +    
    1.50 +    @Test public void longShiftR2() throws Exception {
    1.51 +        final long res = 0x00fa37d7763e0ca1l >> 32;
    1.52 +        assertExec("Long >> 32",
    1.53 +            Numbers.class, "shrL__J_3BI", 
    1.54 +            Double.valueOf(res),
    1.55 +                new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
    1.56 +                32);
    1.57 +    }
    1.58 +    
    1.59 +    @Test public void longShiftR3() throws Exception {
    1.60 +        final long res = 0x00fa37d7763e0ca1l >> 45;
    1.61 +        assertExec("Long >> 45",
    1.62 +            Numbers.class, "shrL__J_3BI", 
    1.63 +            Double.valueOf(res),
    1.64 +                new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
    1.65 +                45);
    1.66      }
    1.67      
    1.68      private static CharSequence codeSeq;