diff options
Diffstat (limited to 'tests/testutil.hpp')
-rw-r--r-- | tests/testutil.hpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/testutil.hpp b/tests/testutil.hpp index 4e0287a..58f1afd 100644 --- a/tests/testutil.hpp +++ b/tests/testutil.hpp @@ -173,4 +173,10 @@ inline void bounce (void *sb, void *sc) assert (memcmp (buf2, content, 32) == 0); } +// Check whether measured time is the expected time (in milliseconds). +// The upper tolerance is 1/2 sec so that the test doesn't fail even on +// very slow or very loaded systems. +#define time_assert(actual,expected) \ + assert (actual > ((expected) - 50) && actual < ((expected) + 500)); + #endif |