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