aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-03-18 20:54:01 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-03-18 21:03:34 +0100
commitf0d54f88c46929c66341460ffd67ddfdfbf512fe (patch)
tree8f2fb184d87194caaa31a3ed802b763c3c9a6717
parent2a0e244b0af72a444e0a8caff6b86819fba1ed3a (diff)
downloadcpp-utils-f0d54f88c46929c66341460ffd67ddfdfbf512fe.tar.gz
cpp-utils-f0d54f88c46929c66341460ffd67ddfdfbf512fe.zip
timer: inc upper bound in test
-rw-r--r--test/timer.cc19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/timer.cc b/test/timer.cc
index 3b5b5ac..4874d80 100644
--- a/test/timer.cc
+++ b/test/timer.cc
@@ -16,9 +16,9 @@ int main() {
const timer::scoped_timer kS{t};
usleep(100 * 1000);
}
- assert(100000 < t.as_usec() && t.as_usec() < 101000);
- assert(100 < t.as_msec() && t.as_msec() < 101);
- assert(0.100 < t.as_sec() && t.as_sec() < 0.101);
+ assert(100000 < t.as_usec() && t.as_usec() < 102000);
+ assert(100 < t.as_msec() && t.as_msec() < 102);
+ assert(0.100 < t.as_sec() && t.as_sec() < 0.102);
kShowTime();
{
@@ -26,9 +26,10 @@ int main() {
const timer::scoped_timer kS{t};
usleep(500 * 1000);
}
- assert(600000 < t.as_usec() && t.as_usec() < 601000);
- assert(600 < t.as_msec() && t.as_msec() < 601);
- assert(0.600 < t.as_sec() && t.as_sec() < 0.601);
+ kShowTime();
+ assert(600000 < t.as_usec() && t.as_usec() < 603000);
+ assert(600 < t.as_msec() && t.as_msec() < 603);
+ assert(0.600 < t.as_sec() && t.as_sec() < 0.603);
kShowTime();
t.reset();
@@ -37,9 +38,9 @@ int main() {
timer::scoped_timer s{t};
usleep(200 * 1000);
}
- assert(200000 < t.as_usec() && t.as_usec() < 201000);
- assert(200 < t.as_msec() && t.as_msec() < 201);
- assert(0.200 < t.as_sec() && t.as_sec() < 0.201);
+ assert(200000 < t.as_usec() && t.as_usec() < 202000);
+ assert(200 < t.as_msec() && t.as_msec() < 202);
+ assert(0.200 < t.as_sec() && t.as_sec() < 0.202);
kShowTime();
return 0;