From: Jonathan Boulle Date: Thu, 4 Aug 2016 13:54:10 +0000 (+0200) Subject: src/test: add tests for parse_percent_unbounded (#3889) X-Git-Tag: v232~335 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1898a1a5c37ba019c7a5a48505befd64f78071dc;p=thirdparty%2Fsystemd.git src/test: add tests for parse_percent_unbounded (#3889) --- diff --git a/src/test/test-parse-util.c b/src/test/test-parse-util.c index 0a76308f726..097c4642290 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; }