summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2017-04-18 20:18:52 +0200
committerMurray Cumming <murrayc@murrayc.com>2017-04-18 21:53:16 +0200
commitbfd34aa5a37c5ac4f28a9941a56352f873c2e745 (patch)
treeb33c9fba87a778a1b76d5bc78b05d6fd53197838 /tests
parent0e5df130392be8238f5bbbea3c9144e9dd683a17 (diff)
downloadglibmm-bfd34aa5a37c5ac4f28a9941a56352f873c2e745.tar.gz
NodeTree: Move enums into class, and use C++11 enum classes.
Diffstat (limited to 'tests')
-rw-r--r--tests/glibmm_nodetree/main.cc36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/glibmm_nodetree/main.cc b/tests/glibmm_nodetree/main.cc
index c4033de9..fee12ffc 100644
--- a/tests/glibmm_nodetree/main.cc
+++ b/tests/glibmm_nodetree/main.cc
@@ -49,16 +49,16 @@ main()
g_assert(root->depth() == 1);
g_assert(root->get_max_height() == 4);
g_assert(node_G->first_child()->next_sibling()->depth() == 4);
- g_assert(root->node_count(type_nodetree_string::TRAVERSE_LEAVES) == 7);
- g_assert(root->node_count(type_nodetree_string::TRAVERSE_NON_LEAVES) == 4);
- g_assert(root->node_count(type_nodetree_string::TRAVERSE_ALL) == 11);
+ g_assert(root->node_count(type_nodetree_string::TraverseFlags::LEAVES) == 7);
+ g_assert(root->node_count(type_nodetree_string::TraverseFlags::NON_LEAVES) == 4);
+ g_assert(root->node_count(type_nodetree_string::TraverseFlags::ALL) == 11);
g_assert(node_F->get_max_height() == 3);
g_assert(node_G->child_count() == 4);
- g_assert(root->find_child("F", type_nodetree_string::TRAVERSE_ALL) == node_F);
+ g_assert(root->find_child("F", type_nodetree_string::TraverseFlags::ALL) == node_F);
g_assert(
- root->find("I", Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_NON_LEAVES) == NULL);
+ root->find("I", type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::NON_LEAVES) == NULL);
g_assert(
- root->find("J", Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_LEAVES) == node_J);
+ root->find("J", type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::LEAVES) == node_J);
for (guint i = 0; i < node_B->child_count(); i++)
{
@@ -83,28 +83,28 @@ main()
tstring.clear();
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_PRE_ORDER, type_nodetree_string::TRAVERSE_ALL, -1);
+ type_nodetree_string::TraverseType::PRE_ORDER, type_nodetree_string::TraverseFlags::ALL, -1);
g_assert(tstring == "ABCDEFGHIJK");
tstring.clear();
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_POST_ORDER, type_nodetree_string::TRAVERSE_ALL, -1);
+ type_nodetree_string::TraverseType::POST_ORDER, type_nodetree_string::TraverseFlags::ALL, -1);
g_assert(tstring == "CDEBHIJKGFA");
tstring.clear();
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_ALL, -1);
+ type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::ALL, -1);
g_assert(tstring == "CBDEAHGIJKF");
tstring.clear();
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_ALL, -1);
+ type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::ALL, -1);
g_assert(tstring == "ABFCDEGHIJK");
tstring.clear();
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_LEAVES, -1);
+ type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::LEAVES, -1);
g_assert(tstring == "CDEHIJK");
tstring.clear();
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_PRE_ORDER, type_nodetree_string::TRAVERSE_NON_LEAVES, -1);
+ type_nodetree_string::TraverseType::PRE_ORDER, type_nodetree_string::TraverseFlags::NON_LEAVES, -1);
g_assert(tstring == "ABFG");
tstring.clear();
@@ -112,18 +112,18 @@ main()
node_G->reverse_children();
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_LEVEL_ORDER, type_nodetree_string::TRAVERSE_ALL, -1);
+ type_nodetree_string::TraverseType::LEVEL_ORDER, type_nodetree_string::TraverseFlags::ALL, -1);
g_assert(tstring == "ABFEDCGKJIH");
tstring.clear();
node = new type_nodetree_string(*root); // A deep copy.
- g_assert(root->node_count(type_nodetree_string::TRAVERSE_ALL) ==
- node->node_count(type_nodetree_string::TRAVERSE_ALL));
+ g_assert(root->node_count(type_nodetree_string::TraverseFlags::ALL) ==
+ node->node_count(type_nodetree_string::TraverseFlags::ALL));
g_assert(root->get_max_height() == node->get_max_height());
root->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(tstring)),
- Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_ALL, -1);
+ type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::ALL, -1);
node->traverse(sigc::bind(sigc::ptr_fun(node_build_string), std::ref(cstring)),
- Glib::TRAVERSE_IN_ORDER, type_nodetree_string::TRAVERSE_ALL, -1);
+ type_nodetree_string::TraverseType::IN_ORDER, type_nodetree_string::TraverseFlags::ALL, -1);
g_assert(tstring == cstring);
delete node;
@@ -142,7 +142,7 @@ main()
node = node->first_child()->next_sibling();
}
g_assert(root->get_max_height() > 100);
- g_assert(root->node_count(type_nodetree_string::TRAVERSE_ALL) == 1 + 2048);
+ g_assert(root->node_count(type_nodetree_string::TraverseFlags::ALL) == 1 + 2048);
delete root;