Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: tests/language/bit_operations_test.dart

Issue 10440082: Fix a bug in ia32 shift left , implemented more inlined binary operations in x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/token.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/bit_operations_test.dart
===================================================================
--- tests/language/bit_operations_test.dart (revision 8116)
+++ tests/language/bit_operations_test.dart (working copy)
@@ -53,7 +53,35 @@
TestNegativeValueShifts();
TestPositiveValueShifts();
TestNoMaskingOfShiftCount();
+ TestNegativeCountShifts();
}
+
+ static void TestNegativeCountShifts() {
+ bool throwOnLeft(a, b) {
+ try {
+ var x = a << b;
+ return false;
+ } catch(var e) {
+ return true;
+ }
+ }
+
+ bool throwOnRight(a, b) {
+ try {
+ var x = a >> b;
+ return false;
+ } catch(var e) {
+ return true;
+ }
+ }
+
+ Expect.isTrue(throwOnLeft(12, -3));
+ Expect.isTrue(throwOnRight(12, -3));
+ for (int i = 0; i < 4000; i++) {
+ Expect.isFalse(throwOnLeft(12, 3));
+ Expect.isFalse(throwOnRight(12, 3));
+ }
+ }
static void TestNegativeValueShifts() {
for (int value = 0; value > -100; value--) {
« no previous file with comments | « runtime/vm/token.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698