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

Side by Side Diff: src/base/bits-unittest.cc

Issue 527273003: Fix NaCl build. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/base/platform/semaphore.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/bits.h" 5 #include "src/base/bits.h"
6 #include "src/base/macros.h" 6 #include "src/base/macros.h"
7 #include "testing/gtest-support.h" 7 #include "testing/gtest-support.h"
8 8
9 #ifdef DEBUG 9 #ifdef DEBUG
10 #define DISABLE_IN_RELEASE(Name) Name 10 #define DISABLE_IN_RELEASE(Name) Name
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 TEST(Bits, RoundUpToPowerOfTwo32) { 77 TEST(Bits, RoundUpToPowerOfTwo32) {
78 TRACED_FORRANGE(uint32_t, shift, 0, 31) { 78 TRACED_FORRANGE(uint32_t, shift, 0, 31) {
79 EXPECT_EQ(1u << shift, RoundUpToPowerOfTwo32(1u << shift)); 79 EXPECT_EQ(1u << shift, RoundUpToPowerOfTwo32(1u << shift));
80 } 80 }
81 EXPECT_EQ(0u, RoundUpToPowerOfTwo32(0)); 81 EXPECT_EQ(0u, RoundUpToPowerOfTwo32(0));
82 EXPECT_EQ(4u, RoundUpToPowerOfTwo32(3)); 82 EXPECT_EQ(4u, RoundUpToPowerOfTwo32(3));
83 EXPECT_EQ(0x80000000u, RoundUpToPowerOfTwo32(0x7fffffffu)); 83 EXPECT_EQ(0x80000000u, RoundUpToPowerOfTwo32(0x7fffffffu));
84 } 84 }
85 85
86 86
87 #if 0
88 // TODO(bmeurer): Fix this on NaCL builds.
89 TEST(BitsDeathTest, DISABLE_IN_RELEASE(RoundUpToPowerOfTwo32)) { 87 TEST(BitsDeathTest, DISABLE_IN_RELEASE(RoundUpToPowerOfTwo32)) {
90 ASSERT_DEATH({ RoundUpToPowerOfTwo32(0x80000001u); }, "0x80000000"); 88 ASSERT_DEATH_IF_SUPPORTED({ RoundUpToPowerOfTwo32(0x80000001u); },
89 "0x80000000");
91 } 90 }
92 #endif
93 91
94 92
95 TEST(Bits, RoundDownToPowerOfTwo32) { 93 TEST(Bits, RoundDownToPowerOfTwo32) {
96 TRACED_FORRANGE(uint32_t, shift, 0, 31) { 94 TRACED_FORRANGE(uint32_t, shift, 0, 31) {
97 EXPECT_EQ(1u << shift, RoundDownToPowerOfTwo32(1u << shift)); 95 EXPECT_EQ(1u << shift, RoundDownToPowerOfTwo32(1u << shift));
98 } 96 }
99 EXPECT_EQ(0u, RoundDownToPowerOfTwo32(0)); 97 EXPECT_EQ(0u, RoundDownToPowerOfTwo32(0));
100 EXPECT_EQ(4u, RoundDownToPowerOfTwo32(5)); 98 EXPECT_EQ(4u, RoundDownToPowerOfTwo32(5));
101 EXPECT_EQ(0x80000000u, RoundDownToPowerOfTwo32(0x80000001u)); 99 EXPECT_EQ(0x80000000u, RoundDownToPowerOfTwo32(0x80000001u));
102 } 100 }
(...skipping 14 matching lines...) Expand all
117 EXPECT_EQ(0u, RotateRight64(0u, shift)); 115 EXPECT_EQ(0u, RotateRight64(0u, shift));
118 } 116 }
119 EXPECT_EQ(1u, RotateRight64(1, 0)); 117 EXPECT_EQ(1u, RotateRight64(1, 0));
120 EXPECT_EQ(1u, RotateRight64(2, 1)); 118 EXPECT_EQ(1u, RotateRight64(2, 1));
121 EXPECT_EQ(V8_UINT64_C(0x8000000000000000), RotateRight64(1, 1)); 119 EXPECT_EQ(V8_UINT64_C(0x8000000000000000), RotateRight64(1, 1));
122 } 120 }
123 121
124 } // namespace bits 122 } // namespace bits
125 } // namespace base 123 } // namespace base
126 } // namespace v8 124 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/base/platform/semaphore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698