summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/int_ops.post.js28
-rw-r--r--test/int_ops.txt20
2 files changed, 14 insertions, 34 deletions
diff --git a/test/int_ops.post.js b/test/int_ops.post.js
index 995358b2a..f1f84c31b 100644
--- a/test/int_ops.post.js
+++ b/test/int_ops.post.js
@@ -6,36 +6,36 @@ Module.print(Module._clz(-1));
Module.print(Module._clz(8));
// binary
-function testBinary(name) {
+function testBinary(name, noSecondZero, noSecondBig) {
Module.print(name);
function doTest(x, y) {
Module.print(' ' + [x, y] + ' ==> ' + Module['_' + name](x, y));
}
- doTest(0, 0);
+ if (!noSecondZero) doTest(0, 0);
doTest(0, 1);
- doTest(1, 0);
+ if (!noSecondZero) doTest(1, 0);
doTest(1, 1);
doTest(5, 6);
doTest(6, 5);
- doTest(101, -12);
- doTest(-12, 101);
+ if (!noSecondBig) doTest(101, -12);
+ if (!noSecondBig) doTest(-12, 101);
doTest(-1, 5);
- doTest(5, -1);
- doTest(-1, -1);
+ if (!noSecondBig) doTest(5, -1);
+ if (!noSecondBig) doTest(-1, -1);
}
testBinary('add');
testBinary('sub');
testBinary('mul');
-testBinary('sdiv');
-testBinary('udiv');
-testBinary('srem');
-testBinary('urem');
+testBinary('sdiv', true);
+testBinary('udiv', true);
+testBinary('srem', true);
+testBinary('urem', true);
testBinary('and');
testBinary('or');
testBinary('xor');
-testBinary('shl');
-testBinary('sshr');
-testBinary('ushr');
+testBinary('shl', false, true);
+testBinary('sshr', false, true);
+testBinary('ushr', false, true);
// comparisons
testBinary('eq');
diff --git a/test/int_ops.txt b/test/int_ops.txt
index c67a078e1..d159a4123 100644
--- a/test/int_ops.txt
+++ b/test/int_ops.txt
@@ -39,9 +39,7 @@ mul
5,-1 ==> -5
-1,-1 ==> 1
sdiv
- 0,0 ==> 0
0,1 ==> 0
- 1,0 ==> 0
1,1 ==> 1
5,6 ==> 0
6,5 ==> 1
@@ -51,9 +49,7 @@ sdiv
5,-1 ==> -5
-1,-1 ==> 1
udiv
- 0,0 ==> 0
0,1 ==> 0
- 1,0 ==> 0
1,1 ==> 1
5,6 ==> 0
6,5 ==> 1
@@ -63,9 +59,7 @@ udiv
5,-1 ==> 0
-1,-1 ==> 1
srem
- 0,0 ==> 0
0,1 ==> 0
- 1,0 ==> 0
1,1 ==> 0
5,6 ==> 5
6,5 ==> 1
@@ -75,9 +69,7 @@ srem
5,-1 ==> 0
-1,-1 ==> 0
urem
- 0,0 ==> 0
0,1 ==> 0
- 1,0 ==> 0
1,1 ==> 0
5,6 ==> 5
6,5 ==> 1
@@ -129,11 +121,7 @@ shl
1,1 ==> 2
5,6 ==> 320
6,5 ==> 192
- 101,-12 ==> 105906176
- -12,101 ==> -384
-1,5 ==> -32
- 5,-1 ==> -2147483648
- -1,-1 ==> -2147483648
sshr
0,0 ==> 0
0,1 ==> 0
@@ -141,11 +129,7 @@ sshr
1,1 ==> 0
5,6 ==> 0
6,5 ==> 0
- 101,-12 ==> 0
- -12,101 ==> -1
-1,5 ==> -1
- 5,-1 ==> 0
- -1,-1 ==> -1
ushr
0,0 ==> 0
0,1 ==> 0
@@ -153,11 +137,7 @@ ushr
1,1 ==> 0
5,6 ==> 0
6,5 ==> 0
- 101,-12 ==> 0
- -12,101 ==> 134217727
-1,5 ==> 134217727
- 5,-1 ==> 0
- -1,-1 ==> 1
eq
0,0 ==> 1
0,1 ==> 0