Chromium Code Reviews| Index: blimp/net/helium/vector_clock_generator_unittest.cc |
| diff --git a/blimp/net/helium/vector_clock_generator_unittest.cc b/blimp/net/helium/vector_clock_generator_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..26674c3fc6876ad7cf54efb66627e7c734d6cf66 |
| --- /dev/null |
| +++ b/blimp/net/helium/vector_clock_generator_unittest.cc |
| @@ -0,0 +1,39 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "blimp/net/helium/vector_clock_generator.h" |
| + |
| +#include "base/macros.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace blimp { |
| +namespace { |
| + |
| +class VectorClockGeneratorTest : public testing::Test { |
| + public: |
| + VectorClockGeneratorTest() {} |
| + ~VectorClockGeneratorTest() override {} |
| + |
| + protected: |
| + VectorClockGenerator gen_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(VectorClockGeneratorTest); |
| +}; |
| + |
| +TEST_F(VectorClockGeneratorTest, nextFollowedByLast) { |
|
Kevin M
2016/10/05 23:41:30
Don't understand this test name
scf
2016/10/06 19:47:17
Done.
|
| + VectorClock c1 = gen_.current(); |
| + EXPECT_EQ(VectorClock::Comparison::EqualTo, c1.CompareTo(gen_.current())); |
| +} |
| + |
| +TEST_F(VectorClockGeneratorTest, monotonicallyIncreasing) { |
|
Kevin M
2016/10/05 23:41:30
MonotonicallyIncreasing
|
| + VectorClock c1 = gen_.current(); |
| + gen_.increment(); |
| + VectorClock c2 = gen_.current(); |
| + EXPECT_EQ(VectorClock::Comparison::GreaterThan, c2.CompareTo(c1)); |
| + EXPECT_EQ(VectorClock::Comparison::EqualTo, c2.CompareTo(gen_.current())); |
| +} |
| + |
| +} // namespace |
| +} // namespace blimp |