summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2001-11-26 19:08:46 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2001-11-26 19:08:46 +0000
commite409b5ae5eb3b6cdfc7c85a2a587363eccccc8d1 (patch)
treea667a89f5fa9214a4923efd9b425cb21d1fcbac9 /tests
parente44629811335fe969a4d5bb10e8f4ae5a5f74a0f (diff)
downloadglib-e409b5ae5eb3b6cdfc7c85a2a587363eccccc8d1.tar.gz
Implement G_LEVEL_ORDER correctly.
* glib/gnode.c (g_node_traverse): Implement G_LEVEL_ORDER correctly. * tests/node-test.c: Add a testcase for G_LEVEL_ORDER implementation. * glib/tmpl/trees-nary.sgml: Document G_LEVEL_ORDER better.
Diffstat (limited to 'tests')
-rw-r--r--tests/node-test.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/node-test.c b/tests/node-test.c
index 31b5db4db..8f5b54d81 100644
--- a/tests/node-test.c
+++ b/tests/node-test.c
@@ -88,6 +88,7 @@ g_node_test (void)
GNode *root;
GNode *node;
GNode *node_B;
+ GNode *node_D;
GNode *node_F;
GNode *node_G;
GNode *node_J;
@@ -105,7 +106,8 @@ g_node_test (void)
g_node_append_data (node_B, C2P ('E'));
g_node_prepend_data (node_B, C2P ('C'));
- g_node_insert (node_B, 1, g_node_new (C2P ('D')));
+ node_D = g_node_new (C2P ('D'));
+ g_node_insert (node_B, 1, node_D);
node_F = g_node_new (C2P ('F'));
g_node_append (root, node_F);
@@ -180,6 +182,13 @@ g_node_test (void)
TEST (tstring, strcmp (tstring, "ABFEDCGKJIH") == 0);
g_free (tstring); tstring = NULL;
+ g_node_append (node_D, g_node_new (C2P ('L')));
+ g_node_append (node_D, g_node_new (C2P ('M')));
+
+ g_node_traverse (root, G_LEVEL_ORDER, G_TRAVERSE_ALL, -1, node_build_string, &tstring);
+ TEST (tstring, strcmp (tstring, "ABFEDCGLMKJIH") == 0);
+ g_free (tstring); tstring = NULL;
+
g_node_destroy (root);
/* allocation tests */