]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/time: no need to abs(uint64_t) for comparing 7726/head
authorKefu Chai <kchai@redhat.com>
Sat, 20 Feb 2016 07:27:07 +0000 (15:27 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 20 Feb 2016 07:27:09 +0000 (15:27 +0800)
fixes
```
/home/kefu/dev/ceph/src/test/common/test_time.cc: In instantiation of
‘void system_clock_conversions() [with Clock =
ceph::time_detail::real_clock]’:
/home/kefu/dev/ceph/src/test/common/test_time.cc:134:40:   required from
here
/home/kefu/dev/ceph/src/test/common/test_time.cc:125:169: error: call of
overloaded ‘abs(std::chrono::duration<long unsigned int, std::ratio<1l,
1000000000l> >::rep)’ is ambiguous
   ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30);
```

as std::abs() does not have a specialization for unsigned types, and we
are using uint64_t as the `typename duration<>::rep`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/common/test_time.cc

index 2e6ad4bbcbd2bdc4c9d8bebcd6d3834ce51bb61e..0f6fc2090a71003745a9c6e8aecc76f2d462a8cf 100644 (file)
@@ -122,7 +122,7 @@ static void system_clock_conversions() {
 
   ASSERT_EQ(Clock::to_double(brt), bd);
   // Fudge factor
-  ASSERT_LT(abs((Clock::from_double(bd) - brt).count()), 30);
+  ASSERT_LT((Clock::from_double(bd) - brt).count(), 30U);
 }
 
 TEST(RealClock, Sanity) {