summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJonathan Boulle <jonathanboulle@gmail.com>2016-08-04 15:54:10 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-04 09:54:10 -0400
commit1898a1a5c37ba019c7a5a48505befd64f78071dc (patch)
tree38b56642a415601685b181d7066e87bdebe4f823 /src/test
parent5124866d7355b685c08aef6abc618e03367e4b93 (diff)
src/test: add tests for parse_percent_unbounded (#3889)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-parse-util.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/test-parse-util.c b/src/test/test-parse-util.c
index 0a76308f72..097c464229 100644
--- a/src/test/test-parse-util.c
+++ b/src/test/test-parse-util.c
@@ -493,6 +493,11 @@ static void test_parse_percent(void) {
assert_se(parse_percent("1%%") == -EINVAL);
}
+static void test_parse_percent_unbounded(void) {
+ assert_se(parse_percent_unbounded("101%") == 101);
+ assert_se(parse_percent_unbounded("400%") == 400);
+}
+
int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
@@ -507,6 +512,7 @@ int main(int argc, char *argv[]) {
test_safe_atoi16();
test_safe_atod();
test_parse_percent();
+ test_parse_percent_unbounded();
return 0;
}