1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Thu Feb 07 16:11:53 2013 +0100
1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Thu Feb 14 12:06:16 2013 +0100
1.3 @@ -144,186 +144,6 @@
1.4 );
1.5 }
1.6
1.7 - @Test public void longShiftL1() throws Exception {
1.8 - final long res = 0x00fa37d7763e0ca1l << 5;
1.9 - assertExec("Long << 5",
1.10 - Numbers.class, "shlL__J_3BI",
1.11 - Double.valueOf(res),
1.12 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.13 - 5);
1.14 - }
1.15 -
1.16 - @Test public void longShiftL2() throws Exception {
1.17 - final long res = 0x00fa37d7763e0ca1l << 32;
1.18 - assertExec("Long << 32",
1.19 - Numbers.class, "shlL__J_3BI",
1.20 - Double.valueOf(res),
1.21 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.22 - 32);
1.23 - }
1.24 -
1.25 - @Test public void longShiftL3() throws Exception {
1.26 - final long res = 0x00fa37d7763e0ca1l << 45;
1.27 - assertExec("Long << 45",
1.28 - Numbers.class, "shlL__J_3BI",
1.29 - Double.valueOf(res),
1.30 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.31 - 45);
1.32 - }
1.33 -
1.34 - @Test public void longShiftR1() throws Exception {
1.35 - final long res = 0x00fa37d7763e0ca1l >> 5;
1.36 - assertExec("Long >> 5",
1.37 - Numbers.class, "shrL__J_3BI",
1.38 - Double.valueOf(res),
1.39 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.40 - 5);
1.41 - }
1.42 -
1.43 - @Test public void longShiftR2() throws Exception {
1.44 - final long res = 0x00fa37d7763e0ca1l >> 32;
1.45 - assertExec("Long >> 32",
1.46 - Numbers.class, "shrL__J_3BI",
1.47 - Double.valueOf(res),
1.48 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.49 - 32);
1.50 - }
1.51 -
1.52 - @Test public void longShiftR3() throws Exception {
1.53 - final long res = 0x00fa37d7763e0ca1l >> 45;
1.54 - assertExec("Long >> 45",
1.55 - Numbers.class, "shrL__J_3BI",
1.56 - Double.valueOf(res),
1.57 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.58 - 45);
1.59 - }
1.60 -
1.61 - @Test public void longUShiftR1() throws Exception {
1.62 - final long res = 0x00fa37d7763e0ca1l >>> 5;
1.63 - assertExec("Long >>> 5",
1.64 - Numbers.class, "ushrL__J_3BI",
1.65 - Double.valueOf(res),
1.66 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.67 - 5);
1.68 - }
1.69 -
1.70 - @Test public void longUShiftR2() throws Exception {
1.71 - final long res = 0x00fa37d7763e0ca1l >>> 45;
1.72 - assertExec("Long >>> 45",
1.73 - Numbers.class, "ushrL__J_3BI",
1.74 - Double.valueOf(res),
1.75 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.76 - 45);
1.77 - }
1.78 -
1.79 - @Test public void longUShiftR3() throws Exception {
1.80 - final long res = 0xf0fa37d7763e0ca1l >>> 5;
1.81 - assertExec("Long >>> 5",
1.82 - Numbers.class, "ushrL__J_3BI",
1.83 - Double.valueOf(res),
1.84 - new byte[] { (byte)0xf0, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.85 - 5);
1.86 - }
1.87 -
1.88 - @Test public void longUShiftR4() throws Exception {
1.89 - final long res = 0xf0fa37d7763e0ca1l >>> 45;
1.90 - assertExec("Long >>> 45",
1.91 - Numbers.class, "ushrL__J_3BI",
1.92 - Double.valueOf(res),
1.93 - new byte[] { (byte)0xf0, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.94 - 45);
1.95 - }
1.96 -
1.97 - @Test public void longAnd() throws Exception {
1.98 - final long res = 0x00fa37d7763e0ca1l & 0xa7b3432fff00123el;
1.99 - assertExec("LOng binary AND",
1.100 - Numbers.class, "andL__J_3B_3B",
1.101 - Double.valueOf(res),
1.102 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.103 - new byte[] { (byte)0xa7, (byte)0xb3, (byte)0x43, (byte)0x2f, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.104 - );
1.105 - }
1.106 -
1.107 - @Test public void longOr() throws Exception {
1.108 - final long res = 0x00fa37d7763e0ca1l | 0xa7b3432fff00123el;
1.109 - assertExec("Long binary OR",
1.110 - Numbers.class, "orL__J_3B_3B",
1.111 - Double.valueOf(res),
1.112 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.113 - new byte[] { (byte)0xa7, (byte)0xb3, (byte)0x43, (byte)0x2f, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.114 - );
1.115 - }
1.116 -
1.117 - @Test public void longXor1() throws Exception {
1.118 - final long res = 0x00fa37d7763e0ca1l ^ 0xa7b3432fff00123el;
1.119 - assertExec("Long binary XOR",
1.120 - Numbers.class, "xorL__J_3B_3B",
1.121 - Double.valueOf(res),
1.122 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.123 - new byte[] { (byte)0xa7, (byte)0xb3, (byte)0x43, (byte)0x2f, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.124 - );
1.125 - }
1.126 -
1.127 - @Test public void longXor2() throws Exception {
1.128 - final long res = 0x00fa37d7763e0ca1l ^ 0x00000000ff00123el;
1.129 - assertExec("Long binary XOR",
1.130 - Numbers.class, "xorL__J_3B_3B",
1.131 - Double.valueOf(res),
1.132 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.133 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.134 - );
1.135 - }
1.136 -
1.137 - @Test public void longXor3() throws Exception {
1.138 - final long res = 0x00000000763e0ca1l ^ 0x00000000ff00123el;
1.139 - assertExec("Long binary XOR",
1.140 - Numbers.class, "xorL__J_3B_3B",
1.141 - Double.valueOf(res),
1.142 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.143 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.144 - );
1.145 - }
1.146 -
1.147 - @Test public void longCompareSameNumbers() throws Exception {
1.148 - assertExec("Long compare same numbers",
1.149 - Numbers.class, "compareL__I_3B_3BI",
1.150 - 0.0,
1.151 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.152 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.153 - 0
1.154 - );
1.155 - }
1.156 -
1.157 - @Test public void longComparePositiveNumbers() throws Exception {
1.158 - assertExec("Long compare positive numbers",
1.159 - Numbers.class, "compareL__I_3B_3BI",
1.160 - -1.0,
1.161 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x00 },
1.162 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x10, (byte)0x00, (byte)0x00, (byte)0x00 },
1.163 - 0
1.164 - );
1.165 - }
1.166 -
1.167 - @Test public void longCompareNegativeNumbers() throws Exception {
1.168 - assertExec("Long compare negative numbers",
1.169 - Numbers.class, "compareL__I_3B_3BI",
1.170 - 1.0,
1.171 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.172 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.173 - 0
1.174 - );
1.175 - }
1.176 -
1.177 - @Test public void longCompareMixedNumbers() throws Exception {
1.178 - assertExec("Long compare mixed numbers",
1.179 - Numbers.class, "compareL__I_3B_3BI",
1.180 - -1.0,
1.181 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.182 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.183 - 0
1.184 - );
1.185 - }
1.186 -
1.187 private static CharSequence codeSeq;
1.188 private static Invocable code;
1.189