| Index: tests/language/modulo_test.dart
|
| ===================================================================
|
| --- tests/language/modulo_test.dart (revision 30236)
|
| +++ tests/language/modulo_test.dart (working copy)
|
| @@ -11,23 +11,18 @@
|
| for (int i = -30; i < 30; i++) {
|
| Expect.equals(i % 256, foo(i));
|
| Expect.equals(i % -256, boo(i));
|
| - try {
|
| - hoo(i);
|
| - Expect.fail("Exception expected.");
|
| - } catch (e) {}
|
| + Expect.throws(() => hoo(i), (e) => e is IntegerDivisionByZeroException);
|
| +
|
| + Expect.equals(i ~/ 256 + i % 256, fooTwo(i));
|
| + Expect.equals(i ~/ -256 + i % -256, booTwo(i));
|
| + Expect.throws(() => hooTwo(i), (e) => e is IntegerDivisionByZeroException);
|
| }
|
| }
|
|
|
| -foo(i) {
|
| - return i % 256; // This will get optimized to AND instruction.
|
| -}
|
| +foo(i) => i % 256; // This will get optimized to AND instruction.
|
| +boo(i) => i % -256;
|
| +hoo(i) => i % 0;
|
|
|
| -
|
| -boo(i) {
|
| - return i % -256;
|
| -}
|
| -
|
| -
|
| -hoo(i) {
|
| - return i % 0;
|
| -}
|
| +fooTwo(i) => i ~/ 256 + i % 256;
|
| +booTwo(i) => i ~/ -256 + i % -256;
|
| +hooTwo(i) => i ~/ 0 + i % 0;
|
|
|