diff options
author | Murray Cumming <murrayc@murrayc.com> | 2008-07-29 10:10:29 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2008-07-29 10:10:29 +0000 |
commit | 4557a2658060067d1efb9c929fe2949fbff1c212 (patch) | |
tree | 81c124205248c5be8d72c1b70ffc943ece2aa79d /tests | |
parent | e74b63cfa3ad05e586d95c6ed8a6fc86c36f885b (diff) | |
download | glibmm-4557a2658060067d1efb9c929fe2949fbff1c212.tar.gz |
Build the docs at the end, after the tests, to save time when testing API
2008-07-29 Murray Cumming <murrayc@murrayc.com>
* Makefile.am: Build the docs at the end, after the tests, to
save time when testing API changes.
* glib/src/tree.hg: Const corrections: Add const and non-const versions
of many methods, instead of returning non-const objects from const methods.
find().
Changed max_height() to get_max_height() for consistency.
* tests/glibmm_tree/main.cc: Adapted to changed API.
svn path=/trunk/; revision=698
Diffstat (limited to 'tests')
-rw-r--r-- | tests/glibmm_tree/main.cc | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/tests/glibmm_tree/main.cc b/tests/glibmm_tree/main.cc index 879458fc..bf93d153 100644 --- a/tests/glibmm_tree/main.cc +++ b/tests/glibmm_tree/main.cc @@ -1,5 +1,4 @@ #include <iostream> - #include <glibmm.h> bool echo(Glib::Tree<std::string>& i) @@ -63,41 +62,51 @@ int main() std::cout << std::endl; Glib::Tree<std::string> *tmp = ta.find(Glib::IN_ORDER, Glib::TRAVERSE_LEAVES | Glib::TRAVERSE_NON_LEAVES, e); - if(NULL == tmp){ std::cout << e << " not found" << std::endl; } - else{ std::cout << "Found " << (tmp->data()) << std::endl; } + if(!tmp) + std::cout << e << " not found" << std::endl; + else + std::cout << "Found " << (tmp->data()) << std::endl; tmp = ta.find(Glib::IN_ORDER, Glib::TRAVERSE_LEAVES | Glib::TRAVERSE_NON_LEAVES, a); - if(NULL == tmp){ std::cout << a << " not found" << std::endl; } - else{ std::cout << "Found " << (tmp->data()) << std::endl; } + if(!tmp) + std::cout << a << " not found" << std::endl; + else + std::cout << "Found " << (tmp->data()) << std::endl; tmp = ta.find(Glib::IN_ORDER, Glib::TRAVERSE_LEAVES | Glib::TRAVERSE_NON_LEAVES, "f"); - if(NULL == tmp){ std::cout << a << " not found" << std::endl; } - else{ std::cout << "Found " << (tmp->data()) << std::endl; } + if(!tmp) + std::cout << a << " not found" << std::endl; + else + std::cout << "Found " << (tmp->data()) << std::endl; tmp = ta.find_child(Glib::TRAVERSE_LEAVES | Glib::TRAVERSE_NON_LEAVES, e); - if(NULL == tmp){ std::cout << e << " is not a child of " << (ta.data()) << std::endl; } - else{ std::cout << "Mistakenly found " << e << " in " << (ta.data()) << "'s children" << std::endl; } + if(!tmp) + std::cout << e << " is not a child of " << (ta.data()) << std::endl; + else + std::cout << "Mistakenly found " << e << " in " << (ta.data()) << "'s children" << std::endl; tmp = ta.find_child(Glib::TRAVERSE_LEAVES | Glib::TRAVERSE_NON_LEAVES, c); - if(NULL == tmp) { + if(!tmp) std::cout << c << " is the number " << ta.child_index(c) << " child of " << (ta.data()) << std::endl; - } - else{ std::cout << "Mistakenly didn't find " << c << " in " << (ta.data()) << "'s children" << std::endl; } + else + std::cout << "Mistakenly didn't find " << c << " in " << (ta.data()) << "'s children" << std::endl; tmp = tc.next_sibling(); - if(NULL == tmp){ std::cout << tc.data() << "'s next sibling is NULL" << std::endl; } - else{ std::cout << tc.data() << "'s next sibling is " << tmp->data() << std::endl; } + if(!tmp) + std::cout << tc.data() << "'s next sibling is NULL" << std::endl; + else + std::cout << tc.data() << "'s next sibling is " << tmp->data() << std::endl; - tmp = ta.root(); + tmp = ta.get_root(); std::cout << "Root is " << (tmp->data()) << std::endl; - std::cout << "Depth is " << tmp->max_height() << std::endl; + std::cout << "Depth is " << tmp->get_max_height() << std::endl; ta.unlink(tc); - std::cout << "New depth is " << tmp->max_height() << std::endl; + std::cout << "New depth is " << tmp->get_max_height() << std::endl; - tmp = tc.root(); + tmp = tc.get_root(); std::cout << "Pruned root is " << (tmp->data()) << std::endl; - std::cout << "Pruned depth is " << tmp->max_height() << std::endl; + std::cout << "Pruned depth is " << tmp->get_max_height() << std::endl; return 0; } |