diff options
| author | Ian Rogers <irogers@google.com> | 2012-02-17 14:47:17 -0800 |
|---|---|---|
| committer | Ian Rogers <irogers@google.com> | 2012-02-17 14:47:17 -0800 |
| commit | 55b16ceff1068cce61c86f2c9ca011a97c869bd4 (patch) | |
| tree | 83102ef8fecdf4b68a9f8c5a1b1847bea8e0fa6b /test/003-omnibus-opcodes/src/IntMath.java | |
| parent | cbfe6fea382328cd5a0a9906b61da5ed4ae3eaab (diff) | |
| download | art-55b16ceff1068cce61c86f2c9ca011a97c869bd4.tar.gz art-55b16ceff1068cce61c86f2c9ca011a97c869bd4.tar.bz2 art-55b16ceff1068cce61c86f2c9ca011a97c869bd4.zip | |
Test behavior of int shifts >= 32
Change-Id: I6e228418068b70447295f367ed56ff8cb86abd33
Diffstat (limited to 'test/003-omnibus-opcodes/src/IntMath.java')
| -rw-r--r-- | test/003-omnibus-opcodes/src/IntMath.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/003-omnibus-opcodes/src/IntMath.java b/test/003-omnibus-opcodes/src/IntMath.java index be883b9e7d..292fdd3877 100644 --- a/test/003-omnibus-opcodes/src/IntMath.java +++ b/test/003-omnibus-opcodes/src/IntMath.java @@ -85,6 +85,39 @@ public class IntMath { Main.assertTrue(i == 268435455); } + static void shiftTest3(int thirtyTwo) { + System.out.println("IntMath.shiftTest3"); + + int one = thirtyTwo / 32; + int sixteen = thirtyTwo / 2; + int thirtyThree = thirtyTwo + 1; + int sixtyFour = thirtyTwo * 2; + + Main.assertTrue(1 << thirtyTwo == 1); + Main.assertTrue((1 << sixteen) << sixteen == 0); + Main.assertTrue(1 << thirtyThree == 2); + Main.assertTrue(1 << -one == -2147483648); + Main.assertTrue(1 << -thirtyTwo == 1); + Main.assertTrue(1 << -thirtyThree == -2147483648); + Main.assertTrue(1 << thirtyThree == 2); + + Main.assertTrue(1 >> thirtyTwo == 1); + Main.assertTrue((1 >> sixteen) >> sixteen == 0); + Main.assertTrue(1 >> thirtyThree == 0); + Main.assertTrue(1 >> -one == 0); + Main.assertTrue(1 >> -thirtyTwo == 1); + Main.assertTrue(1 >> -thirtyThree == 0); + Main.assertTrue(-4 >> thirtyThree == -2); + + Main.assertTrue(1 >>> thirtyTwo == 1); + Main.assertTrue((1 >>> sixteen) >>> sixteen == 0); + Main.assertTrue(1 >>> thirtyThree == 0); + Main.assertTrue(1 >>> -one == 0); + Main.assertTrue(1 >>> -thirtyTwo == 1); + Main.assertTrue(1 >>> -thirtyThree == 0); + Main.assertTrue(-4 >>> thirtyThree == 2147483646); + } + static void convTest() { System.out.println("IntMath.convTest"); @@ -469,6 +502,7 @@ public class IntMath { shiftTest1(); shiftTest2(); unsignedShiftTest(); + shiftTest3(32); convTest(); charSubTest(); |
