Revert "test/time: no need to abs(uint64_t) for comparing"

This reverts commit da0f6608dd.

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 <sage@redhat.com>
This commit is contained in:
Sage Weil 2016-03-11 17:42:27 -05:00
parent ff3b456946
commit 4c97aac89d

View File

@ -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) {