aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-21 14:32:05 +0000
committerTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-25 11:08:43 +0000
commit0ec1dddb0e75c235edfc68d72f4471ad186c3399 (patch)
tree254cdda75b06c8453a207933a8d556c1db90b997 /storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp
parenta0d854b6a3fab6fe44b1164c071fc994b331c3bc (diff)
Convert remaining CppUnit tests to GTest
Move base message sender stub out to common test module to avoid artificial dependency from persistence tests to the distributor tests.
Diffstat (limited to 'storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp')
-rw-r--r--storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp41
1 files changed, 10 insertions, 31 deletions
diff --git a/storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp b/storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp
index 6a3cd1a5537..c47cb862c73 100644
--- a/storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp
+++ b/storage/src/tests/distributor/ownership_transfer_safe_time_point_calculator_test.cpp
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/storage/distributor/ownership_transfer_safe_time_point_calculator.h>
-#include <vespa/vdstestlib/cppunit/macros.h>
+#include <vespa/vespalib/gtest/gtest.h>
template <typename Clock, typename Duration>
std::ostream& operator<<(std::ostream& os,
@@ -12,21 +12,7 @@ std::ostream& operator<<(std::ostream& os,
return os;
}
-namespace storage {
-namespace distributor {
-
-struct OwnershipTransferSafeTimePointCalculatorTest : CppUnit::TestFixture {
- void generated_safe_time_point_rounds_up_to_nearest_second();
- void zero_clock_skew_returns_epoch();
-
- CPPUNIT_TEST_SUITE(OwnershipTransferSafeTimePointCalculatorTest);
- CPPUNIT_TEST(generated_safe_time_point_rounds_up_to_nearest_second);
- CPPUNIT_TEST(zero_clock_skew_returns_epoch);
- CPPUNIT_TEST_SUITE_END();
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(OwnershipTransferSafeTimePointCalculatorTest);
-
+namespace storage::distributor {
using CalcType = OwnershipTransferSafeTimePointCalculator;
using Clock = CalcType::Clock;
@@ -34,23 +20,16 @@ using TimePoint = CalcType::TimePoint;
using namespace std::literals::chrono_literals;
-void OwnershipTransferSafeTimePointCalculatorTest::generated_safe_time_point_rounds_up_to_nearest_second() {
- CPPUNIT_ASSERT_EQUAL(TimePoint(6s),
- CalcType(1s).safeTimePoint(TimePoint(4001ms)));
- CPPUNIT_ASSERT_EQUAL(TimePoint(6s),
- CalcType(1s).safeTimePoint(TimePoint(4999ms)));
- CPPUNIT_ASSERT_EQUAL(TimePoint(6s),
- CalcType(1s).safeTimePoint(TimePoint(4000ms)));
- CPPUNIT_ASSERT_EQUAL(TimePoint(7s),
- CalcType(2s).safeTimePoint(TimePoint(4001ms)));
- CPPUNIT_ASSERT_EQUAL(TimePoint(7s),
- CalcType(2s).safeTimePoint(TimePoint(4999ms)));
+TEST(OwnershipTransferSafeTimePointCalculatorTest, generated_safe_time_point_rounds_up_to_nearest_second) {
+ EXPECT_EQ(TimePoint(6s), CalcType(1s).safeTimePoint(TimePoint(4001ms)));
+ EXPECT_EQ(TimePoint(6s), CalcType(1s).safeTimePoint(TimePoint(4999ms)));
+ EXPECT_EQ(TimePoint(6s), CalcType(1s).safeTimePoint(TimePoint(4000ms)));
+ EXPECT_EQ(TimePoint(7s), CalcType(2s).safeTimePoint(TimePoint(4001ms)));
+ EXPECT_EQ(TimePoint(7s), CalcType(2s).safeTimePoint(TimePoint(4999ms)));
}
-void OwnershipTransferSafeTimePointCalculatorTest::zero_clock_skew_returns_epoch() {
- CPPUNIT_ASSERT_EQUAL(TimePoint(0s),
- CalcType(0s).safeTimePoint(TimePoint(4001ms)));
+TEST(OwnershipTransferSafeTimePointCalculatorTest, zero_clock_skew_returns_epoch) {
+ EXPECT_EQ(TimePoint(0s), CalcType(0s).safeTimePoint(TimePoint(4001ms)));
}
}
-}