From 4c97aac89dbdd6ffb240630056b874270cd3853c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 11 Mar 2016 17:42:27 -0500 Subject: [PATCH] Revert "test/time: no need to abs(uint64_t) for comparing" This reverts commit da0f6608dd6cc3356e727e739575f496c2b6a590. unittest_time fails: [==========] Running 4 tests from 2 test cases. [----------] Global test environment set-up. [----------] 2 tests from RealClock [ RUN ] RealClock.Sanity [ OK ] RealClock.Sanity (0 ms) [ RUN ] RealClock.Conversions test/common/test_time.cc:125: Failure Expected: ((Clock::from_double(bd) - brt).count()) < (30U), actual: 18446744073709551595 vs 30 [ FAILED ] RealClock.Conversions (0 ms) [----------] 2 tests from RealClock (0 ms total) [----------] 2 tests from CoarseRealClock [ RUN ] CoarseRealClock.Sanity [ OK ] CoarseRealClock.Sanity (0 ms) [ RUN ] CoarseRealClock.Conversions test/common/test_time.cc:125: Failure Expected: ((Clock::from_double(bd) - brt).count()) < (30U), actual: 18446744073709551595 vs 30 [ FAILED ] CoarseRealClock.Conversions (0 ms) [----------] 2 tests from CoarseRealClock (0 ms total) [----------] Global test environment tear-down [==========] 4 tests from 2 test cases ran. (0 ms total) [ PASSED ] 2 tests. [ FAILED ] 2 tests, listed below: [ FAILED ] RealClock.Conversions [ FAILED ] CoarseRealClock.Conversions Signed-off-by: Sage Weil --- src/test/common/test_time.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/common/test_time.cc b/src/test/common/test_time.cc index 0f6fc2090a7..2e6ad4bbcbd 100644 --- a/src/test/common/test_time.cc +++ b/src/test/common/test_time.cc @@ -122,7 +122,7 @@ static void system_clock_conversions() { ASSERT_EQ(Clock::to_double(brt), bd); // Fudge factor - ASSERT_LT((Clock::from_double(bd) - brt).count(), 30U); + ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30); } TEST(RealClock, Sanity) {