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

Unified Diff: tests/language/bit_operations_test.dart

Issue 10539068: Add righ shift test for corner cases, use macro for deopt reasons (all suggested by Slava in a prev… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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/code_generator.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 8451)
+++ tests/language/bit_operations_test.dart (working copy)
@@ -54,8 +54,22 @@
TestPositiveValueShifts();
TestNoMaskingOfShiftCount();
TestNegativeCountShifts();
+ for (int i = 0; i < 1000; i++) {
+ TestCornerCasesLeftShifts();
+ }
}
+ static void TestCornerCasesLeftShifts() {
+ var v32 = 0xFF000000;
+ var v64 = 0xFF00000000000000;
+ Expect.equals(0x3, v32 >> 0x1E);
+ Expect.equals(0x1, v32 >> 0x1F);
+ Expect.equals(0x0, v32 >> 0x20);
+ Expect.equals(0x3, v64 >> 0x3E);
+ Expect.equals(0x1, v64 >> 0x3F);
+ Expect.equals(0x0, v64 >> 0x40);
+ }
+
static void TestNegativeCountShifts() {
bool throwOnLeft(a, b) {
try {
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698