summaryrefslogtreecommitdiff
path: root/src/test/test-time.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-02-24 13:27:10 +0100
committerDaniel Mack <daniel@zonque.org>2015-02-24 13:27:10 +0100
commitfdd30a1530810b659345c565e97beef06b7af2fd (patch)
tree938112b85198323cf13f052e0ae504123e8ac017 /src/test/test-time.c
parent8e8933ca0f06bae19cb6db601e83b33f8ac80f2a (diff)
test-time: test "infinity" parsing in nanoseconds
Diffstat (limited to 'src/test/test-time.c')
-rw-r--r--src/test/test-time.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/test-time.c b/src/test/test-time.c
index 8cfc4cc4fe..3840fff061 100644
--- a/src/test/test-time.c
+++ b/src/test/test-time.c
@@ -78,12 +78,18 @@ static void test_parse_nsec(void) {
assert_se(u == 2);
assert_se(parse_nsec(".7", &u) >= 0);
assert_se(u == 0);
+ assert_se(parse_nsec("infinity", &u) >= 0);
+ assert_se(u == NSEC_INFINITY);
+ assert_se(parse_nsec(" infinity ", &u) >= 0);
+ assert_se(u == NSEC_INFINITY);
assert_se(parse_nsec(" xyz ", &u) < 0);
assert_se(parse_nsec("", &u) < 0);
assert_se(parse_nsec(" . ", &u) < 0);
assert_se(parse_nsec(" 5. ", &u) < 0);
assert_se(parse_nsec(".s ", &u) < 0);
+ assert_se(parse_nsec(" infinity .7", &u) < 0);
+ assert_se(parse_nsec(".3 infinity", &u) < 0);
}
static void test_format_timespan_one(usec_t x, usec_t accuracy) {