summaryrefslogtreecommitdiffstats
path: root/src/test/test-time-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-07-17 13:01:46 +0200
committerLennart Poettering <lennart@poettering.net>2018-07-17 13:01:46 +0200
commit5a9fb35843d2384a5539a079c4d13c095705fa94 (patch)
treed16035e0cd59aa7a0ded90a8b3e535d0e729cc07 /src/test/test-time-util.c
parentMerge pull request #9601 from yuwata/small-fixes (diff)
downloadsystemd-5a9fb35843d2384a5539a079c4d13c095705fa94.tar.xz
systemd-5a9fb35843d2384a5539a079c4d13c095705fa94.zip
parse-util: make sure "-0.-0s" is not considered a valid time specification
Did I mention that strtoll() is super-hard to use properly?
Diffstat (limited to 'src/test/test-time-util.c')
-rw-r--r--src/test/test-time-util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c
index 87de8d172c..d7cb459e66 100644
--- a/src/test/test-time-util.c
+++ b/src/test/test-time-util.c
@@ -42,6 +42,12 @@ static void test_parse_sec(void) {
assert_se(parse_sec(" . ", &u) < 0);
assert_se(parse_sec(" 5. ", &u) < 0);
assert_se(parse_sec(".s ", &u) < 0);
+ assert_se(parse_sec("-5s ", &u) < 0);
+ assert_se(parse_sec("-0.3s ", &u) < 0);
+ assert_se(parse_sec("-0.0s ", &u) < 0);
+ assert_se(parse_sec("-0.-0s ", &u) < 0);
+ assert_se(parse_sec("0.-0s ", &u) < 0);
+ assert_se(parse_sec("3.-0s ", &u) < 0);
assert_se(parse_sec(" infinity .7", &u) < 0);
assert_se(parse_sec(".3 infinity", &u) < 0);
}