OLD | NEW |
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 <limits.h> | 5 #include <limits.h> |
6 | 6 |
7 #include "src/base/atomic-utils.h" | 7 #include "src/base/atomic-utils.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 TEST(AtomicNumber, OperatorSubtractionAssignment) { | 77 TEST(AtomicNumber, OperatorSubtractionAssignment) { |
78 AtomicNumber<size_t> a(std::numeric_limits<size_t>::max()); | 78 AtomicNumber<size_t> a(std::numeric_limits<size_t>::max()); |
79 AtomicNumber<size_t> b(std::numeric_limits<size_t>::max()); | 79 AtomicNumber<size_t> b(std::numeric_limits<size_t>::max()); |
80 a -= b.Value(); | 80 a -= b.Value(); |
81 EXPECT_EQ(a.Value(), 0u); | 81 EXPECT_EQ(a.Value(), 0u); |
82 EXPECT_EQ(b.Value(), std::numeric_limits<size_t>::max()); | 82 EXPECT_EQ(b.Value(), std::numeric_limits<size_t>::max()); |
83 } | 83 } |
84 | 84 |
85 namespace { | 85 namespace { |
86 | 86 |
87 enum TestFlag { | 87 enum TestFlag : base::AtomicWord { |
88 kA, | 88 kA, |
89 kB, | 89 kB, |
90 kC, | 90 kC, |
91 }; | 91 }; |
92 | 92 |
93 } // namespace | 93 } // namespace |
94 | 94 |
95 | 95 |
96 TEST(AtomicValue, Initial) { | 96 TEST(AtomicValue, Initial) { |
97 AtomicValue<TestFlag> a(kA); | 97 AtomicValue<TestFlag> a(kA); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 a.Add(kAA); | 265 a.Add(kAA); |
266 EXPECT_FALSE(a == b); | 266 EXPECT_FALSE(a == b); |
267 EXPECT_TRUE(a != b); | 267 EXPECT_TRUE(a != b); |
268 b.Add(kAA); | 268 b.Add(kAA); |
269 EXPECT_TRUE(a == b); | 269 EXPECT_TRUE(a == b); |
270 EXPECT_FALSE(a != b); | 270 EXPECT_FALSE(a != b); |
271 } | 271 } |
272 | 272 |
273 } // namespace base | 273 } // namespace base |
274 } // namespace v8 | 274 } // namespace v8 |
OLD | NEW |