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

Unified Diff: runtime/vm/utils_test.cc

Issue 558753003: Fix ancient Windows freelist bug. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/platform/utils_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/utils_test.cc
===================================================================
--- runtime/vm/utils_test.cc (revision 40061)
+++ runtime/vm/utils_test.cc (working copy)
@@ -117,6 +117,23 @@
}
+UNIT_TEST_CASE(CountZeros) {
+ EXPECT_EQ(0, Utils::CountTrailingZeros(0x1));
+ EXPECT_EQ(kBitsPerWord - 1, Utils::CountLeadingZeros(0x1));
+ EXPECT_EQ(1, Utils::CountTrailingZeros(0x2));
+ EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZeros(0x2));
+ EXPECT_EQ(0, Utils::CountTrailingZeros(0x3));
+ EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZeros(0x3));
+ EXPECT_EQ(2, Utils::CountTrailingZeros(0x4));
+ EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZeros(0x4));
+ EXPECT_EQ(0, Utils::CountTrailingZeros(kUwordMax));
+ EXPECT_EQ(0, Utils::CountLeadingZeros(kUwordMax));
+ static const uword kTopBit = static_cast<uword>(1) << (kBitsPerWord - 1);
+ EXPECT_EQ(kBitsPerWord - 1, Utils::CountTrailingZeros(kTopBit));
+ EXPECT_EQ(0, Utils::CountLeadingZeros(kTopBit));
+}
+
+
UNIT_TEST_CASE(IsInt) {
EXPECT(Utils::IsInt(8, 16));
EXPECT(Utils::IsInt(8, 127));
« no previous file with comments | « runtime/platform/utils_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698