]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
src/test: add tests for parse_percent_unbounded (#3889)
authorJonathan Boulle <jonathanboulle@gmail.com>
Thu, 4 Aug 2016 13:54:10 +0000 (15:54 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Aug 2016 13:54:10 +0000 (09:54 -0400)
src/test/test-parse-util.c

index 0a76308f726da768e97605db4c22849e7e82c883..097c4642290dbc43b82c1d1431eede27a2e2f0e5 100644 (file)
@@ -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;
 }