]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dsdb audit tests: Use assert_in_range() for comparing timestamps
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 16 Mar 2022 22:20:45 +0000 (11:20 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 17 Mar 2022 00:41:34 +0000 (00:41 +0000)
This can make the code clearer. assert_in_range() takes only integer
parameters, but POSIX allows us to assume that time_t is an integer.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/tests/test_audit_log.c

index 2885b7fe744d518303a6d206e2b57752552d2e35..885248e5fb9314908ec76fe4fcc9a09202f85097 100644 (file)
@@ -74,8 +74,7 @@ static void check_timestamp(time_t before, const char* timestamp)
        /*
         * The timestamp should be before <= actual <= after
         */
-       assert_true(difftime(actual, before) >= 0);
-       assert_true(difftime(after, actual) >= 0);
+       assert_in_range(actual, before, after);
 }
 
 static void test_has_password_changed(void **state)