Index: test/unittests/base/atomic-utils-unittest.cc |
diff --git a/test/unittests/base/atomic-utils-unittest.cc b/test/unittests/base/atomic-utils-unittest.cc |
index 06079fe287148a8f87e4a87229da3b23a63e7126..8e90c423e2cd5526352471816078f5e9ac351975 100644 |
--- a/test/unittests/base/atomic-utils-unittest.cc |
+++ b/test/unittests/base/atomic-utils-unittest.cc |
@@ -58,6 +58,29 @@ TEST(AtomicNumber, Increment) { |
EXPECT_EQ(std::numeric_limits<size_t>::max(), c.Value()); |
} |
+TEST(AtomicNumber, Decrement) { |
+ AtomicNumber<size_t> a(std::numeric_limits<size_t>::max()); |
+ a.Increment(1); |
+ EXPECT_EQ(0, a.Value()); |
+ a.Decrement(1); |
+ EXPECT_EQ(std::numeric_limits<size_t>::max(), a.Value()); |
+} |
+ |
+TEST(AtomicNumber, OperatorAdditionAssignment) { |
+ AtomicNumber<size_t> a(0u); |
+ AtomicNumber<size_t> b(std::numeric_limits<size_t>::max()); |
+ a += b.Value(); |
+ EXPECT_EQ(a.Value(), b.Value()); |
+ EXPECT_EQ(b.Value(), std::numeric_limits<size_t>::max()); |
+} |
+ |
+TEST(AtomicNumber, OperatorSubtractionAssignment) { |
+ AtomicNumber<size_t> a(std::numeric_limits<size_t>::max()); |
+ AtomicNumber<size_t> b(std::numeric_limits<size_t>::max()); |
+ a -= b.Value(); |
+ EXPECT_EQ(a.Value(), 0u); |
+ EXPECT_EQ(b.Value(), std::numeric_limits<size_t>::max()); |
+} |
namespace { |