# HG changeset patch # User Martin Soch # Date 1359637174 -3600 # Node ID 171fa0ca3add3819d05c01cb3e1aa00ec840cb3d # Parent 960e219425e2926935d34ec74b78950be817ac44 Added tests for Long >> diff -r 960e219425e2 -r 171fa0ca3add vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Thu Jan 31 13:55:12 2013 +0100 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Thu Jan 31 13:59:34 2013 +0100 @@ -173,32 +173,56 @@ @Test public void longShiftL1() throws Exception { final long res = 0x00fa37d7763e0ca1l << 5; - assertExec("Long MAX", + assertExec("Long << 5", Numbers.class, "shlL__J_3BI", Double.valueOf(res), new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }, - 5 - ); + 5); } @Test public void longShiftL2() throws Exception { final long res = 0x00fa37d7763e0ca1l << 32; - assertExec("Long MAX", + assertExec("Long << 32", Numbers.class, "shlL__J_3BI", Double.valueOf(res), new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }, - 32 - ); + 32); } @Test public void longShiftL3() throws Exception { final long res = 0x00fa37d7763e0ca1l << 45; - assertExec("Long MAX", + assertExec("Long << 45", Numbers.class, "shlL__J_3BI", Double.valueOf(res), new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }, - 45 - ); + 45); + } + + @Test public void longShiftR1() throws Exception { + final long res = 0x00fa37d7763e0ca1l >> 5; + assertExec("Long >> 5", + Numbers.class, "shrL__J_3BI", + Double.valueOf(res), + new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }, + 5); + } + + @Test public void longShiftR2() throws Exception { + final long res = 0x00fa37d7763e0ca1l >> 32; + assertExec("Long >> 32", + Numbers.class, "shrL__J_3BI", + Double.valueOf(res), + new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }, + 32); + } + + @Test public void longShiftR3() throws Exception { + final long res = 0x00fa37d7763e0ca1l >> 45; + assertExec("Long >> 45", + Numbers.class, "shrL__J_3BI", + Double.valueOf(res), + new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }, + 45); } private static CharSequence codeSeq;