From 73245450b302931ad291de5d8d0f0cb5e9ca3ee6 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 21 Feb 2017 21:13:47 +0100 Subject: test-cutils: Add missing qemu_strtol()... endptr checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1487708048-2131-4-git-send-email-armbru@redhat.com> --- tests/test-cutils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test-cutils.c b/tests/test-cutils.c index 20b0f59..71681dc 100644 --- a/tests/test-cutils.c +++ b/tests/test-cutils.c @@ -262,6 +262,7 @@ static void test_qemu_strtol_empty(void) err = qemu_strtol(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtol_whitespace(void) @@ -275,6 +276,7 @@ static void test_qemu_strtol_whitespace(void) err = qemu_strtol(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtol_invalid(void) @@ -288,6 +290,7 @@ static void test_qemu_strtol_invalid(void) err = qemu_strtol(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtol_trailing(void) @@ -548,6 +551,7 @@ static void test_qemu_strtoul_empty(void) err = qemu_strtoul(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoul_whitespace(void) @@ -561,6 +565,7 @@ static void test_qemu_strtoul_whitespace(void) err = qemu_strtoul(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoul_invalid(void) @@ -574,6 +579,7 @@ static void test_qemu_strtoul_invalid(void) err = qemu_strtoul(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoul_trailing(void) @@ -829,6 +835,7 @@ static void test_qemu_strtoll_empty(void) err = qemu_strtoll(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoll_whitespace(void) @@ -842,6 +849,7 @@ static void test_qemu_strtoll_whitespace(void) err = qemu_strtoll(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoll_invalid(void) @@ -855,6 +863,7 @@ static void test_qemu_strtoll_invalid(void) err = qemu_strtoll(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoll_trailing(void) @@ -1113,6 +1122,7 @@ static void test_qemu_strtoull_empty(void) err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoull_whitespace(void) @@ -1126,6 +1136,7 @@ static void test_qemu_strtoull_whitespace(void) err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoull_invalid(void) @@ -1139,6 +1150,7 @@ static void test_qemu_strtoull_invalid(void) err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, -EINVAL); + g_assert(endptr == str); } static void test_qemu_strtoull_trailing(void) -- cgit v1.1