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

Unified Diff: blimp/net/helium/vector_clock_generator_unittest.cc

Issue 2382533002: Helium: Initial proto and Syncable interface definition (Closed)
Patch Set: test changes Created 4 years, 2 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 | « blimp/net/helium/vector_clock_generator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..42dcba0eb0b942d9a63f16eabfc89371f7be20a4
--- /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, CheckCurrentDoesntIncrease) {
+ VectorClock c1 = gen_.current();
+ EXPECT_EQ(VectorClock::Comparison::EqualTo, c1.CompareTo(gen_.current()));
+}
+
+TEST_F(VectorClockGeneratorTest, 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
« no previous file with comments | « blimp/net/helium/vector_clock_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698