|
|
357786 |
From 34251ed7b01f81a0e62fa56548db657a5c238125 Mon Sep 17 00:00:00 2001
|
|
|
357786 |
From: Markus Armbruster <armbru@redhat.com>
|
|
|
357786 |
Date: Mon, 18 Jun 2018 08:43:26 +0200
|
|
|
357786 |
Subject: [PATCH 19/54] check-block-qdict: Rename qdict_flatten()'s variables
|
|
|
357786 |
for clarity
|
|
|
357786 |
|
|
|
357786 |
RH-Author: Markus Armbruster <armbru@redhat.com>
|
|
|
357786 |
Message-id: <20180618084330.30009-20-armbru@redhat.com>
|
|
|
357786 |
Patchwork-id: 80721
|
|
|
357786 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 19/23] check-block-qdict: Rename qdict_flatten()'s variables for clarity
|
|
|
357786 |
Bugzilla: 1557995
|
|
|
357786 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
357786 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
357786 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
|
|
|
357786 |
Signed-off-by: Markus Armbruster <armbru@redhat.com>
|
|
|
357786 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
357786 |
(cherry picked from commit cddec036830ada5d5d45023bcfba09015b8ab394)
|
|
|
357786 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
357786 |
---
|
|
|
357786 |
tests/check-block-qdict.c | 57 ++++++++++++++++++++++++-----------------------
|
|
|
357786 |
1 file changed, 29 insertions(+), 28 deletions(-)
|
|
|
357786 |
|
|
|
357786 |
diff --git a/tests/check-block-qdict.c b/tests/check-block-qdict.c
|
|
|
357786 |
index 5b9f4d5..29f58a2 100644
|
|
|
357786 |
--- a/tests/check-block-qdict.c
|
|
|
357786 |
+++ b/tests/check-block-qdict.c
|
|
|
357786 |
@@ -37,11 +37,11 @@ static void qdict_defaults_test(void)
|
|
|
357786 |
|
|
|
357786 |
static void qdict_flatten_test(void)
|
|
|
357786 |
{
|
|
|
357786 |
- QList *list1 = qlist_new();
|
|
|
357786 |
- QList *list2 = qlist_new();
|
|
|
357786 |
- QDict *dict1 = qdict_new();
|
|
|
357786 |
- QDict *dict2 = qdict_new();
|
|
|
357786 |
- QDict *dict3 = qdict_new();
|
|
|
357786 |
+ QList *e_1 = qlist_new();
|
|
|
357786 |
+ QList *e = qlist_new();
|
|
|
357786 |
+ QDict *e_1_2 = qdict_new();
|
|
|
357786 |
+ QDict *f = qdict_new();
|
|
|
357786 |
+ QDict *root = qdict_new();
|
|
|
357786 |
|
|
|
357786 |
/*
|
|
|
357786 |
* Test the flattening of
|
|
|
357786 |
@@ -79,35 +79,36 @@ static void qdict_flatten_test(void)
|
|
|
357786 |
* }
|
|
|
357786 |
*/
|
|
|
357786 |
|
|
|
357786 |
- qdict_put_int(dict1, "a", 0);
|
|
|
357786 |
- qdict_put_int(dict1, "b", 1);
|
|
|
357786 |
+ qdict_put_int(e_1_2, "a", 0);
|
|
|
357786 |
+ qdict_put_int(e_1_2, "b", 1);
|
|
|
357786 |
|
|
|
357786 |
- qlist_append_int(list1, 23);
|
|
|
357786 |
- qlist_append_int(list1, 66);
|
|
|
357786 |
- qlist_append(list1, dict1);
|
|
|
357786 |
- qlist_append_int(list2, 42);
|
|
|
357786 |
- qlist_append(list2, list1);
|
|
|
357786 |
+ qlist_append_int(e_1, 23);
|
|
|
357786 |
+ qlist_append_int(e_1, 66);
|
|
|
357786 |
+ qlist_append(e_1, e_1_2);
|
|
|
357786 |
+ qlist_append_int(e, 42);
|
|
|
357786 |
+ qlist_append(e, e_1);
|
|
|
357786 |
|
|
|
357786 |
- qdict_put_int(dict2, "c", 2);
|
|
|
357786 |
- qdict_put_int(dict2, "d", 3);
|
|
|
357786 |
- qdict_put(dict3, "e", list2);
|
|
|
357786 |
- qdict_put(dict3, "f", dict2);
|
|
|
357786 |
- qdict_put_int(dict3, "g", 4);
|
|
|
357786 |
+ qdict_put_int(f, "c", 2);
|
|
|
357786 |
+ qdict_put_int(f, "d", 3);
|
|
|
357786 |
|
|
|
357786 |
- qdict_flatten(dict3);
|
|
|
357786 |
+ qdict_put(root, "e", e);
|
|
|
357786 |
+ qdict_put(root, "f", f);
|
|
|
357786 |
+ qdict_put_int(root, "g", 4);
|
|
|
357786 |
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "e.0") == 42);
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "e.1.0") == 23);
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "e.1.1") == 66);
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "e.1.2.a") == 0);
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "e.1.2.b") == 1);
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "f.c") == 2);
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "f.d") == 3);
|
|
|
357786 |
- g_assert(qdict_get_int(dict3, "g") == 4);
|
|
|
357786 |
+ qdict_flatten(root);
|
|
|
357786 |
|
|
|
357786 |
- g_assert(qdict_size(dict3) == 8);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "e.0") == 42);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "e.1.0") == 23);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "e.1.1") == 66);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "e.1.2.a") == 0);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "e.1.2.b") == 1);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "f.c") == 2);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "f.d") == 3);
|
|
|
357786 |
+ g_assert(qdict_get_int(root, "g") == 4);
|
|
|
357786 |
|
|
|
357786 |
- qobject_unref(dict3);
|
|
|
357786 |
+ g_assert(qdict_size(root) == 8);
|
|
|
357786 |
+
|
|
|
357786 |
+ qobject_unref(root);
|
|
|
357786 |
}
|
|
|
357786 |
|
|
|
357786 |
static void qdict_array_split_test(void)
|
|
|
357786 |
--
|
|
|
357786 |
1.8.3.1
|
|
|
357786 |
|