1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Mon Feb 11 12:46:43 2013 +0100
1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/NumberTest.java Fri Feb 15 21:14:49 2013 +0100
1.3 @@ -141,552 +141,6 @@
1.4 s
1.5 );
1.6 }
1.7 -
1.8 - @Test public void longConversion() throws Exception {
1.9 - assertExec("Long from cPool",
1.10 - Numbers.class, "conversionL__J",
1.11 - Double.valueOf(Long.MAX_VALUE)
1.12 - );
1.13 - }
1.14 -
1.15 - @Test public void longNegate1() throws Exception {
1.16 - final long res = -0x00fa37d7763e0ca1l;
1.17 - assertExec("Long negate",
1.18 - Numbers.class, "negL__J_3B",
1.19 - Double.valueOf(res),
1.20 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }
1.21 - );
1.22 - }
1.23 -
1.24 - @Test public void longNegate2() throws Exception {
1.25 - final long res = -0x80fa37d7763e0ca1l;
1.26 - assertExec("Long negate",
1.27 - Numbers.class, "negL__J_3B",
1.28 - Double.valueOf(res),
1.29 - new byte[] { (byte)0x80, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 }
1.30 - );
1.31 - }
1.32 -
1.33 - @Test public void longNegate3() throws Exception {
1.34 - final long res = -0xfffffffffffffeddl;
1.35 - assertExec("Long negate",
1.36 - Numbers.class, "negL__J_3B",
1.37 - Double.valueOf(res),
1.38 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xfe, (byte)0xdd }
1.39 - );
1.40 - }
1.41 -
1.42 - @Test public void longAddOverflow() throws Exception {
1.43 - final long res = Long.MAX_VALUE + 1l;
1.44 - assertExec("Addition 1+MAX",
1.45 - Numbers.class, "addL__J_3B_3B",
1.46 - Double.valueOf(res),
1.47 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.48 - new byte[] { (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)1 }
1.49 - );
1.50 - }
1.51 -
1.52 - @Test public void longAddMaxAndMax() throws Exception {
1.53 - final long res = Long.MAX_VALUE + Long.MAX_VALUE;
1.54 - assertExec("Addition MAX+MAX",
1.55 - Numbers.class, "addL__J_3B_3B",
1.56 - Double.valueOf(res),
1.57 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.58 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff }
1.59 - );
1.60 - }
1.61 -
1.62 - @Test public void longSubUnderflow() throws Exception {
1.63 - final long res = Long.MIN_VALUE - 1l;
1.64 - assertExec("Subtraction MIN-1",
1.65 - Numbers.class, "subL__J_3B_3B",
1.66 - Double.valueOf(res),
1.67 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.68 - new byte[] { (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)1 }
1.69 - );
1.70 - }
1.71 -
1.72 - @Test public void longSubMinAndMin() throws Exception {
1.73 - final long res = Long.MIN_VALUE - Long.MIN_VALUE;
1.74 - assertExec("Subtraction MIN-MIN",
1.75 - Numbers.class, "subL__J_3B_3B",
1.76 - Double.valueOf(res),
1.77 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.78 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }
1.79 - );
1.80 - }
1.81 -
1.82 - @Test public void longSubMinAndMax() throws Exception {
1.83 - final long res = Long.MIN_VALUE - Long.MAX_VALUE;
1.84 - assertExec("Subtraction MIN-MAX",
1.85 - Numbers.class, "subL__J_3B_3B",
1.86 - Double.valueOf(res),
1.87 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.88 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff }
1.89 - );
1.90 - }
1.91 -
1.92 - @Test public void longMultiplyMax() throws Exception {
1.93 - final long res = Long.MAX_VALUE * 2l;
1.94 - assertExec("Multiplication MAX*2",
1.95 - Numbers.class, "mulL__J_3B_3B",
1.96 - Double.valueOf(res),
1.97 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.98 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x02 }
1.99 - );
1.100 - }
1.101 -
1.102 - @Test public void longMultiplyMaxAndMax() throws Exception {
1.103 - final long res = Long.MAX_VALUE * Long.MAX_VALUE;
1.104 - assertExec("Multiplication MAX*MAX",
1.105 - Numbers.class, "mulL__J_3B_3B",
1.106 - Double.valueOf(res),
1.107 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.108 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff }
1.109 - );
1.110 - }
1.111 -
1.112 - @Test public void longMultiplyMin() throws Exception {
1.113 - final long res = Long.MIN_VALUE * 2l;
1.114 - assertExec("Multiplication MIN*2",
1.115 - Numbers.class, "mulL__J_3B_3B",
1.116 - Double.valueOf(res),
1.117 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.118 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x02 }
1.119 - );
1.120 - }
1.121 -
1.122 - @Test public void longMultiplyMinAndMin() throws Exception {
1.123 - final long res = Long.MIN_VALUE * Long.MIN_VALUE;
1.124 - assertExec("Multiplication MIN*2",
1.125 - Numbers.class, "mulL__J_3B_3B",
1.126 - Double.valueOf(res),
1.127 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.128 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }
1.129 - );
1.130 - }
1.131 -
1.132 - @Test public void longMultiplyPrecision() throws Exception {
1.133 - final long res = 0x00fa37d7763e0ca1l * 0xa7b3432fff00123el;
1.134 - assertExec("Multiplication",
1.135 - Numbers.class, "mulL__J_3B_3B",
1.136 - Double.valueOf(res),
1.137 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.138 - new byte[] { (byte)0xa7, (byte)0xb3, (byte)0x43, (byte)0x2f, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.139 - );
1.140 - }
1.141 -
1.142 - @Test public void longDivideSmallPositiveNumbers() throws Exception {
1.143 - final long res = 0xabcdef / 0x123;
1.144 - assertExec("Division Small Positive Numbers",
1.145 - Numbers.class, "divL__J_3B_3B",
1.146 - Double.valueOf(res),
1.147 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xab, (byte)0xcd, (byte)0xef },
1.148 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x23 }
1.149 - );
1.150 - }
1.151 -
1.152 - @Test public void longDivideSmallNegativeNumbers() throws Exception {
1.153 - final long res = -0xabcdef / -0x123;
1.154 - assertExec("Division Small Negative Numbers",
1.155 - Numbers.class, "divL__J_3B_3B",
1.156 - Double.valueOf(res),
1.157 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x54, (byte)0x32, (byte)0x11 },
1.158 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xfe, (byte)0xdd }
1.159 - );
1.160 - }
1.161 -
1.162 - @Test public void longDivideSmallMixedNumbers() throws Exception {
1.163 - final long res = 0xabcdef / -0x123;
1.164 - assertExec("Division Small Mixed Numbers",
1.165 - Numbers.class, "divL__J_3B_3B",
1.166 - Double.valueOf(res),
1.167 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xab, (byte)0xcd, (byte)0xef },
1.168 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xfe, (byte)0xdd }
1.169 - );
1.170 - }
1.171 -
1.172 - @Test public void longDividePositiveNumbersOneDigitDenom()
1.173 - throws Exception {
1.174 - final long res = 0xabcdef0102ffffL / 0x654;
1.175 - assertExec("Division Positive Numbers One Digit Denom",
1.176 - Numbers.class, "divL__J_3B_3B",
1.177 - Double.valueOf(res),
1.178 - new byte[] { (byte)0x00, (byte)0xab, (byte)0xcd, (byte)0xef, (byte)0x01, (byte)0x02, (byte)0xff, (byte)0xff },
1.179 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x06, (byte)0x54 }
1.180 - );
1.181 - }
1.182 -
1.183 - @Test public void longDivideNegativeNumbersOneDigitDenom()
1.184 - throws Exception {
1.185 - final long res = -0xabcdef0102ffffL / -0x654;
1.186 - assertExec("Division Negative Numbers One Digit Denom",
1.187 - Numbers.class, "divL__J_3B_3B",
1.188 - Double.valueOf(res),
1.189 - new byte[] { (byte)0xff, (byte)0x54, (byte)0x32, (byte)0x10, (byte)0xfe, (byte)0xfd, (byte)0x00, (byte)0x01 },
1.190 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xf9, (byte)0xac }
1.191 - );
1.192 - }
1.193 -
1.194 - @Test public void longDivideMixedNumbersOneDigitDenom()
1.195 - throws Exception {
1.196 - final long res = -0xabcdef0102ffffL / 0x654;
1.197 - assertExec("Division Mixed Numbers One Digit Denom",
1.198 - Numbers.class, "divL__J_3B_3B",
1.199 - Double.valueOf(res),
1.200 - new byte[] { (byte)0xff, (byte)0x54, (byte)0x32, (byte)0x10, (byte)0xfe, (byte)0xfd, (byte)0x00, (byte)0x01 },
1.201 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x06, (byte)0x54 }
1.202 - );
1.203 - }
1.204 -
1.205 - @Test public void longDividePositiveNumbersMultiDigitDenom()
1.206 - throws Exception {
1.207 - final long res = 0x7ffefc003322aabbL / 0x89ab1000L;
1.208 - assertExec("Division Positive Numbers Multi Digit Denom",
1.209 - Numbers.class, "divL__J_3B_3B",
1.210 - Double.valueOf(res),
1.211 - new byte[] { (byte)0x7f, (byte)0xfe, (byte)0xfc, (byte)0x00, (byte)0x33, (byte)0x22, (byte)0xaa, (byte)0xbb },
1.212 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x89, (byte)0xab, (byte)0x10, (byte)0x00 }
1.213 - );
1.214 - }
1.215 -
1.216 - @Test public void longDivideNegativeNumbersMultiDigitDenom()
1.217 - throws Exception {
1.218 - final long res = -0x7ffefc003322aabbL / -0x123489ab1001L;
1.219 - assertExec("Division Negative Numbers Multi Digit Denom",
1.220 - Numbers.class, "divL__J_3B_3B",
1.221 - Double.valueOf(res),
1.222 - new byte[] { (byte)0x80, (byte)0x01, (byte)0x03, (byte)0xff, (byte)0xcc, (byte)0xdd, (byte)0x55, (byte)0x45 },
1.223 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xed, (byte)0xcb, (byte)0x76, (byte)0x54, (byte)0xef, (byte)0xff }
1.224 - );
1.225 - }
1.226 -
1.227 - @Test public void longDivideMixedNumbersMultiDigitDenom()
1.228 - throws Exception {
1.229 - final long res = 0x7ffefc003322aabbL / -0x38f49b0b7574e36L;
1.230 - assertExec("Division Mixed Numbers Multi Digit Denom",
1.231 - Numbers.class, "divL__J_3B_3B",
1.232 - Double.valueOf(res),
1.233 - new byte[] { (byte)0x7f, (byte)0xfe, (byte)0xfc, (byte)0x00, (byte)0x33, (byte)0x22, (byte)0xaa, (byte)0xbb },
1.234 - new byte[] { (byte)0xfc, (byte)0x70, (byte)0xb6, (byte)0x4f, (byte)0x48, (byte)0xa8, (byte)0xb1, (byte)0xca }
1.235 - );
1.236 - }
1.237 -
1.238 - @Test public void longDivideWithOverflow() throws Exception {
1.239 - final long res = 0x8000fffe0000L / 0x8000ffffL;
1.240 - assertExec("Division With Overflow",
1.241 - Numbers.class, "divL__J_3B_3B",
1.242 - Double.valueOf(res),
1.243 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x00, (byte)0xff, (byte)0xfe, (byte)0x00, (byte)0x00 },
1.244 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x00, (byte)0xff, (byte)0xff }
1.245 - );
1.246 - }
1.247 -
1.248 - @Test public void longDivideWithCorrection() throws Exception {
1.249 - final long res = 0x7fff800000000000L / 0x800000000001L;
1.250 - assertExec("Division With Correction",
1.251 - Numbers.class, "divL__J_3B_3B",
1.252 - Double.valueOf(res),
1.253 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.254 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01 }
1.255 - );
1.256 - }
1.257 -
1.258 - @Test public void longModuloSmallPositiveNumbers() throws Exception {
1.259 - final long res = 0xabcdef % 0x123;
1.260 - assertExec("Modulo Small Positive Numbers",
1.261 - Numbers.class, "modL__J_3B_3B",
1.262 - Double.valueOf(res),
1.263 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xab, (byte)0xcd, (byte)0xef },
1.264 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x23 }
1.265 - );
1.266 - }
1.267 -
1.268 - @Test public void longModuloSmallNegativeNumbers() throws Exception {
1.269 - final long res = -0xabcdef % -0x123;
1.270 - assertExec("Modulo Small Negative Numbers",
1.271 - Numbers.class, "modL__J_3B_3B",
1.272 - Double.valueOf(res),
1.273 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x54, (byte)0x32, (byte)0x11 },
1.274 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xfe, (byte)0xdd }
1.275 - );
1.276 - }
1.277 -
1.278 - @Test public void longModuloSmallMixedNumbers() throws Exception {
1.279 - final long res = 0xabcdef % -0x123;
1.280 - assertExec("Modulo Small Mixed Numbers",
1.281 - Numbers.class, "modL__J_3B_3B",
1.282 - Double.valueOf(res),
1.283 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xab, (byte)0xcd, (byte)0xef },
1.284 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xfe, (byte)0xdd }
1.285 - );
1.286 - }
1.287 -
1.288 - @Test public void longModuloPositiveNumbersOneDigitDenom()
1.289 - throws Exception {
1.290 - final long res = 0xabcdef0102ffffL % 0x654;
1.291 - assertExec("Modulo Positive Numbers One Digit Denom",
1.292 - Numbers.class, "modL__J_3B_3B",
1.293 - Double.valueOf(res),
1.294 - new byte[] { (byte)0x00, (byte)0xab, (byte)0xcd, (byte)0xef, (byte)0x01, (byte)0x02, (byte)0xff, (byte)0xff },
1.295 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x06, (byte)0x54 }
1.296 - );
1.297 - }
1.298 -
1.299 - @Test public void longModuloNegativeNumbersOneDigitDenom()
1.300 - throws Exception {
1.301 - final long res = -0xabcdef0102ffffL % -0x654;
1.302 - assertExec("Modulo Negative Numbers One Digit Denom",
1.303 - Numbers.class, "modL__J_3B_3B",
1.304 - Double.valueOf(res),
1.305 - new byte[] { (byte)0xff, (byte)0x54, (byte)0x32, (byte)0x10, (byte)0xfe, (byte)0xfd, (byte)0x00, (byte)0x01 },
1.306 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xf9, (byte)0xac }
1.307 - );
1.308 - }
1.309 -
1.310 - @Test public void longModuloMixedNumbersOneDigitDenom()
1.311 - throws Exception {
1.312 - final long res = -0xabcdef0102ffffL % 0x654;
1.313 - assertExec("Modulo Mixed Numbers One Digit Denom",
1.314 - Numbers.class, "modL__J_3B_3B",
1.315 - Double.valueOf(res),
1.316 - new byte[] { (byte)0xff, (byte)0x54, (byte)0x32, (byte)0x10, (byte)0xfe, (byte)0xfd, (byte)0x00, (byte)0x01 },
1.317 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x06, (byte)0x54 }
1.318 - );
1.319 - }
1.320 -
1.321 - @Test public void longModuloPositiveNumbersMultiDigitDenom()
1.322 - throws Exception {
1.323 - final long res = 0x7ffefc003322aabbL % 0x89ab1000L;
1.324 - assertExec("Modulo Positive Numbers Multi Digit Denom",
1.325 - Numbers.class, "modL__J_3B_3B",
1.326 - Double.valueOf(res),
1.327 - new byte[] { (byte)0x7f, (byte)0xfe, (byte)0xfc, (byte)0x00, (byte)0x33, (byte)0x22, (byte)0xaa, (byte)0xbb },
1.328 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x89, (byte)0xab, (byte)0x10, (byte)0x00 }
1.329 - );
1.330 - }
1.331 -
1.332 - @Test public void longModuloNegativeNumbersMultiDigitDenom()
1.333 - throws Exception {
1.334 - final long res = -0x7ffefc003322aabbL % -0x123489ab1001L;
1.335 - assertExec("Modulo Negative Numbers Multi Digit Denom",
1.336 - Numbers.class, "modL__J_3B_3B",
1.337 - Double.valueOf(res),
1.338 - new byte[] { (byte)0x80, (byte)0x01, (byte)0x03, (byte)0xff, (byte)0xcc, (byte)0xdd, (byte)0x55, (byte)0x45 },
1.339 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xed, (byte)0xcb, (byte)0x76, (byte)0x54, (byte)0xef, (byte)0xff }
1.340 - );
1.341 - }
1.342 -
1.343 - @Test public void longModuloMixedNumbersMultiDigitDenom()
1.344 - throws Exception {
1.345 - final long res = 0x7ffefc003322aabbL % -0x38f49b0b7574e36L;
1.346 - assertExec("Modulo Mixed Numbers Multi Digit Denom",
1.347 - Numbers.class, "modL__J_3B_3B",
1.348 - Double.valueOf(res),
1.349 - new byte[] { (byte)0x7f, (byte)0xfe, (byte)0xfc, (byte)0x00, (byte)0x33, (byte)0x22, (byte)0xaa, (byte)0xbb },
1.350 - new byte[] { (byte)0xfc, (byte)0x70, (byte)0xb6, (byte)0x4f, (byte)0x48, (byte)0xa8, (byte)0xb1, (byte)0xca }
1.351 - );
1.352 - }
1.353 -
1.354 - @Test public void longModuloWithOverflow() throws Exception {
1.355 - final long res = 0x8000fffe0000L % 0x8000ffffL;
1.356 - assertExec("Modulo With Overflow",
1.357 - Numbers.class, "modL__J_3B_3B",
1.358 - Double.valueOf(res),
1.359 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x00, (byte)0xff, (byte)0xfe, (byte)0x00, (byte)0x00 },
1.360 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x00, (byte)0xff, (byte)0xff }
1.361 - );
1.362 - }
1.363 -
1.364 - @Test public void longModuloWithCorrection() throws Exception {
1.365 - final long res = 0x7fff800000000000L % 0x800000000001L;
1.366 - assertExec("Modulo With Correction",
1.367 - Numbers.class, "modL__J_3B_3B",
1.368 - Double.valueOf(res),
1.369 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.370 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01 }
1.371 - );
1.372 - }
1.373 -
1.374 - @Test public void longShiftL1() throws Exception {
1.375 - final long res = 0x00fa37d7763e0ca1l << 5;
1.376 - assertExec("Long << 5",
1.377 - Numbers.class, "shlL__J_3BI",
1.378 - Double.valueOf(res),
1.379 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.380 - 5);
1.381 - }
1.382 -
1.383 - @Test public void longShiftL2() throws Exception {
1.384 - final long res = 0x00fa37d7763e0ca1l << 32;
1.385 - assertExec("Long << 32",
1.386 - Numbers.class, "shlL__J_3BI",
1.387 - Double.valueOf(res),
1.388 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.389 - 32);
1.390 - }
1.391 -
1.392 - @Test public void longShiftL3() throws Exception {
1.393 - final long res = 0x00fa37d7763e0ca1l << 45;
1.394 - assertExec("Long << 45",
1.395 - Numbers.class, "shlL__J_3BI",
1.396 - Double.valueOf(res),
1.397 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.398 - 45);
1.399 - }
1.400 -
1.401 - @Test public void longShiftR1() throws Exception {
1.402 - final long res = 0x00fa37d7763e0ca1l >> 5;
1.403 - assertExec("Long >> 5",
1.404 - Numbers.class, "shrL__J_3BI",
1.405 - Double.valueOf(res),
1.406 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.407 - 5);
1.408 - }
1.409 -
1.410 - @Test public void longShiftR2() throws Exception {
1.411 - final long res = 0x00fa37d7763e0ca1l >> 32;
1.412 - assertExec("Long >> 32",
1.413 - Numbers.class, "shrL__J_3BI",
1.414 - Double.valueOf(res),
1.415 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.416 - 32);
1.417 - }
1.418 -
1.419 - @Test public void longShiftR3() throws Exception {
1.420 - final long res = 0x00fa37d7763e0ca1l >> 45;
1.421 - assertExec("Long >> 45",
1.422 - Numbers.class, "shrL__J_3BI",
1.423 - Double.valueOf(res),
1.424 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.425 - 45);
1.426 - }
1.427 -
1.428 - @Test public void longUShiftR1() throws Exception {
1.429 - final long res = 0x00fa37d7763e0ca1l >>> 5;
1.430 - assertExec("Long >>> 5",
1.431 - Numbers.class, "ushrL__J_3BI",
1.432 - Double.valueOf(res),
1.433 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.434 - 5);
1.435 - }
1.436 -
1.437 - @Test public void longUShiftR2() throws Exception {
1.438 - final long res = 0x00fa37d7763e0ca1l >>> 45;
1.439 - assertExec("Long >>> 45",
1.440 - Numbers.class, "ushrL__J_3BI",
1.441 - Double.valueOf(res),
1.442 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.443 - 45);
1.444 - }
1.445 -
1.446 - @Test public void longUShiftR3() throws Exception {
1.447 - final long res = 0xf0fa37d7763e0ca1l >>> 5;
1.448 - assertExec("Long >>> 5",
1.449 - Numbers.class, "ushrL__J_3BI",
1.450 - Double.valueOf(res),
1.451 - new byte[] { (byte)0xf0, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.452 - 5);
1.453 - }
1.454 -
1.455 - @Test public void longUShiftR4() throws Exception {
1.456 - final long res = 0xf0fa37d7763e0ca1l >>> 45;
1.457 - assertExec("Long >>> 45",
1.458 - Numbers.class, "ushrL__J_3BI",
1.459 - Double.valueOf(res),
1.460 - new byte[] { (byte)0xf0, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.461 - 45);
1.462 - }
1.463 -
1.464 - @Test public void longAnd() throws Exception {
1.465 - final long res = 0x00fa37d7763e0ca1l & 0xa7b3432fff00123el;
1.466 - assertExec("LOng binary AND",
1.467 - Numbers.class, "andL__J_3B_3B",
1.468 - Double.valueOf(res),
1.469 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.470 - new byte[] { (byte)0xa7, (byte)0xb3, (byte)0x43, (byte)0x2f, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.471 - );
1.472 - }
1.473 -
1.474 - @Test public void longOr() throws Exception {
1.475 - final long res = 0x00fa37d7763e0ca1l | 0xa7b3432fff00123el;
1.476 - assertExec("Long binary OR",
1.477 - Numbers.class, "orL__J_3B_3B",
1.478 - Double.valueOf(res),
1.479 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.480 - new byte[] { (byte)0xa7, (byte)0xb3, (byte)0x43, (byte)0x2f, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.481 - );
1.482 - }
1.483 -
1.484 - @Test public void longXor1() throws Exception {
1.485 - final long res = 0x00fa37d7763e0ca1l ^ 0xa7b3432fff00123el;
1.486 - assertExec("Long binary XOR",
1.487 - Numbers.class, "xorL__J_3B_3B",
1.488 - Double.valueOf(res),
1.489 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.490 - new byte[] { (byte)0xa7, (byte)0xb3, (byte)0x43, (byte)0x2f, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.491 - );
1.492 - }
1.493 -
1.494 - @Test public void longXor2() throws Exception {
1.495 - final long res = 0x00fa37d7763e0ca1l ^ 0x00000000ff00123el;
1.496 - assertExec("Long binary XOR",
1.497 - Numbers.class, "xorL__J_3B_3B",
1.498 - Double.valueOf(res),
1.499 - new byte[] { (byte)0x00, (byte)0xfa, (byte)0x37, (byte)0xd7, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.500 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.501 - );
1.502 - }
1.503 -
1.504 - @Test public void longXor3() throws Exception {
1.505 - final long res = 0x00000000763e0ca1l ^ 0x00000000ff00123el;
1.506 - assertExec("Long binary XOR",
1.507 - Numbers.class, "xorL__J_3B_3B",
1.508 - Double.valueOf(res),
1.509 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x76, (byte)0x3e, (byte)0x0c, (byte)0xa1 },
1.510 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0x00, (byte)0x12, (byte)0x3e }
1.511 - );
1.512 - }
1.513 -
1.514 - @Test public void longCompareSameNumbers() throws Exception {
1.515 - assertExec("Long compare same numbers",
1.516 - Numbers.class, "compareL__I_3B_3BI",
1.517 - 0.0,
1.518 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.519 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.520 - 0
1.521 - );
1.522 - }
1.523 -
1.524 - @Test public void longComparePositiveNumbers() throws Exception {
1.525 - assertExec("Long compare positive numbers",
1.526 - Numbers.class, "compareL__I_3B_3BI",
1.527 - -1.0,
1.528 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x00 },
1.529 - new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x10, (byte)0x00, (byte)0x00, (byte)0x00 },
1.530 - 0
1.531 - );
1.532 - }
1.533 -
1.534 - @Test public void longCompareNegativeNumbers() throws Exception {
1.535 - assertExec("Long compare negative numbers",
1.536 - Numbers.class, "compareL__I_3B_3BI",
1.537 - 1.0,
1.538 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.539 - new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.540 - 0
1.541 - );
1.542 - }
1.543 -
1.544 - @Test public void longCompareMixedNumbers() throws Exception {
1.545 - assertExec("Long compare mixed numbers",
1.546 - Numbers.class, "compareL__I_3B_3BI",
1.547 - -1.0,
1.548 - new byte[] { (byte)0x80, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
1.549 - new byte[] { (byte)0x7f, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff },
1.550 - 0
1.551 - );
1.552 - }
1.553
1.554 private static TestVM code;
1.555