summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-02-03 21:05:59 +0100
committerLennart Poettering <lennart@poettering.net>2016-02-03 23:58:25 +0100
commit2d60169dd60d503712d5c2e81a01158e82e636e6 (patch)
treecb52e26fc8d357e03c2634860554be625fd41d9f /src/test
parent59e73c5b102402ea18aec1f4d69b4daad574e82b (diff)
util: add check that makes sure time_t and TIME_T_MAX work the way we assume they do
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-time.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/test-time.c b/src/test/test-time.c
index ca44f81f9c..254a8d0e52 100644
--- a/src/test/test-time.c
+++ b/src/test/test-time.c
@@ -192,6 +192,8 @@ static void test_usec_add(void) {
}
int main(int argc, char *argv[]) {
+ uintmax_t x;
+
test_parse_sec();
test_parse_time();
test_parse_nsec();
@@ -202,5 +204,13 @@ int main(int argc, char *argv[]) {
test_get_timezones();
test_usec_add();
+ /* Ensure time_t is signed */
+ assert_cc((time_t) -1 < (time_t) 1);
+
+ /* Ensure TIME_T_MAX works correctly */
+ x = (uintmax_t) TIME_T_MAX;
+ x ++;
+ assert((time_t) x < 0);
+
return 0;
}