From abc17b0f8997ab07ae66130edd5dc8c43e72c886 Mon Sep 17 00:00:00 2001 From: iphydf Date: Sun, 8 Jul 2018 08:43:42 +0000 Subject: Factor out time keeping code into its own module: mono_time.c. It turns out, `unix_time` is also monotonic, and is used as such, so I've renamed the new functions to `mono_time_*`. 2018-07-08: ``` 00:01 <@irungentoo> the idea used to be that the unix_time() function could go backward in time but I think I might have started using it like if it could not after I changed it so that it would never go back in time ``` --- toxcore/util_test.cc | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'toxcore/util_test.cc') diff --git a/toxcore/util_test.cc b/toxcore/util_test.cc index 541aa61f..ff57f3fb 100644 --- a/toxcore/util_test.cc +++ b/toxcore/util_test.cc @@ -4,28 +4,7 @@ #include -TEST(Util, UnixTimeIncreasesOverTime) { - unix_time_update(); - uint64_t const start = unix_time(); - - while (start == unix_time()) { - unix_time_update(); - } - - uint64_t const end = unix_time(); - EXPECT_GT(end, start); -} - -TEST(Util, IsTimeout) { - uint64_t const start = unix_time(); - EXPECT_FALSE(is_timeout(start, 1)); - - while (start == unix_time()) { - unix_time_update(); - } - - EXPECT_TRUE(is_timeout(start, 1)); -} +namespace { TEST(Util, TwoRandomIdsAreNotEqual) { uint8_t pk1[CRYPTO_PUBLIC_KEY_SIZE]; @@ -49,3 +28,5 @@ TEST(Util, IdCopyMakesKeysEqual) { EXPECT_TRUE(id_equal(pk1, pk2)); } + +} // namespace -- cgit v1.2.3