From b2cd5b925c529d91fae5fe8373490714e1a8fe6c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 20 Mar 2017 13:55:44 +0100 Subject: test-keyval: Tweaks to improve list coverage We have a negative test case for a list index with leading zero. Add positive ones. Tweak the test case for list index greater or equal the number of elements: test "equal" instead of "greater" to guard against off-by-one mistakes. Signed-off-by: Markus Armbruster Message-Id: <1490014548-15083-2-git-send-email-armbru@redhat.com> Reviewed-by: Eric Blake --- tests/test-keyval.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test-keyval.c b/tests/test-keyval.c index 71288b082c..e97f6d554d 100644 --- a/tests/test-keyval.c +++ b/tests/test-keyval.c @@ -218,14 +218,14 @@ static void test_keyval_parse_list(void) QDECREF(qdict); /* Multiple indexes, last one wins */ - qdict = keyval_parse("list.1=goner,list.0=null,list.1=eins,list.2=zwei", + qdict = keyval_parse("list.1=goner,list.0=null,list.01=eins,list.2=zwei", NULL, &error_abort); g_assert_cmpint(qdict_size(qdict), ==, 1); check_list012(qdict_get_qlist(qdict, "list")); QDECREF(qdict); /* List at deeper nesting */ - qdict = keyval_parse("a.list.1=eins,a.list.0=null,a.list.2=zwei", + qdict = keyval_parse("a.list.1=eins,a.list.00=null,a.list.2=zwei", NULL, &error_abort); g_assert_cmpint(qdict_size(qdict), ==, 1); sub_qdict = qdict_get_qdict(qdict, "a"); @@ -242,7 +242,7 @@ static void test_keyval_parse_list(void) g_assert(!qdict); /* Missing list indexes */ - qdict = keyval_parse("list.2=lonely", NULL, &err); + qdict = keyval_parse("list.1=lonely", NULL, &err); error_free_or_abort(&err); g_assert(!qdict); qdict = keyval_parse("list.0=null,list.2=eins,list.02=zwei", NULL, &err); -- cgit v1.2.3