From 1898a1a5c37ba019c7a5a48505befd64f78071dc Mon Sep 17 00:00:00 2001 From: Jonathan Boulle Date: Thu, 4 Aug 2016 15:54:10 +0200 Subject: src/test: add tests for parse_percent_unbounded (#3889) --- src/test/test-parse-util.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/test/test-parse-util.c') 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; } -- cgit v1.2.3-54-g00ecf