Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r48825 - in sandbox/SOC/2006/tree/trunk/libs/tree: doc example test
From: ockham_at_[hidden]
Date: 2008-09-17 16:54:27


Author: bernhard.reiter
Date: 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
New Revision: 48825
URL: http://svn.boost.org/trac/boost/changeset/48825

Log:
Replace tabs by spaces.
Text files modified:
   sandbox/SOC/2006/tree/trunk/libs/tree/doc/Jamfile.v2 | 10
   sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk | 6
   sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp | 30 +-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_search_test.cpp | 68 ++++----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test.cpp | 332 ++++++++++++++++++++--------------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp | 38 ++--
   sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp | 154 +++++++++---------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/graph_test.cpp | 184 +++++++++++-----------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/helpers.hpp | 90 +++++-----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/interval_search_binary_tree_test.cpp | 56 +++---
   sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp | 296 +++++++++++++++++-----------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/key_search_binary_tree_test.cpp | 298 +++++++++++++++++-----------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/multiway_tree_test.cpp | 16
   sandbox/SOC/2006/tree/trunk/libs/tree/test/nary_tree_test.cpp | 52 +++---
   sandbox/SOC/2006/tree/trunk/libs/tree/test/range_helpers_test.cpp | 124 +++++++-------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/rank_search_binary_tree_test.cpp | 46 ++--
   sandbox/SOC/2006/tree/trunk/libs/tree/test/red_black_tree_test.cpp | 234 ++++++++++++++--------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/rotate_binary_tree_test.cpp | 120 +++++++-------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/search_ordered_vector_test.cpp | 42 ++--
   sandbox/SOC/2006/tree/trunk/libs/tree/test/string_search_binary_tree_test.cpp | 90 +++++-----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_checks.hpp | 112 ++++++------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp | 274 ++++++++++++++++----------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/treap_test.cpp | 68 ++++----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/unbalanced_binary_tree_test.cpp | 104 ++++++------
   24 files changed, 1426 insertions(+), 1418 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/doc/Jamfile.v2
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/doc/Jamfile.v2 (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/doc/Jamfile.v2 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -15,10 +15,12 @@
 doxygen autodoc
         :
                 [ glob ../../../boost/tree/*.hpp ]
- [ glob ../../../boost/tree/algorithm/*.hpp ]
- [ glob ../../../boost/tree/augmentors/*.hpp ]
- [ glob ../../../boost/tree/balancers/*.hpp ]
- [ glob ../../../boost/tree/comparators/*.hpp ]
+ [ glob ../../../boost/tree/detail/algorithm/*.hpp ]
+ [ glob ../../../boost/tree/detail/algorithm/cursor/*.hpp ]
+ [ glob ../../../boost/tree/detail/algorithm/iterator/*.hpp ]
+ [ glob ../../../boost/tree/detail/augmentors/*.hpp ]
+ [ glob ../../../boost/tree/detail/balancers/*.hpp ]
+ [ glob ../../../boost/tree/detail/comparators/*.hpp ]
                 [ glob ../../../boost/tree/detail/cursor/*.hpp ]
                 [ glob ../../../boost/tree/detail/iterator/*.hpp ]
                 [ glob ../../../boost/tree/detail/node/*.hpp ]

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/doc/algorithms.qbk 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -11,6 +11,8 @@
  / Algorithms documentation file.
  /]
 
+[import ../../../boost/tree/detail/algorithm/cursor/preorder.hpp]
+[import ../../../boost/tree/detail/algorithm/cursor/inorder.hpp]
 [import ../../../boost/tree/detail/algorithm/cursor/postorder.hpp]
 [import ../example/for_each.cpp]
 
@@ -43,8 +45,12 @@
 
 [section for_each]
 
+[preorder_for_each]
+[inorder_for_each]
 [postorder_for_each]
 
+[funcref boost::tree:preorder::for_each]
+
 [section Example]
 [for_each]
 [endsect] [/Example]

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -17,25 +17,25 @@
 
 //[ for_each
 void to_cout(int i) {
- std::cout << ' ' << i;
- return;
+ std::cout << ' ' << i;
+ return;
 }
 
 int main() {
- binary_tree<int> bt;
-
- // Fill it with data...
- create_test_data_tree(bt);
+ binary_tree<int> bt;
+
+ // Fill it with data...
+ create_test_data_tree(bt);
 
- std::cout << "Preorder:";
- preorder::for_each(bt.root(), to_cout);
-
- std::cout << std::endl << "Inorder:";
- inorder::for_each(bt.root(), to_cout);
-
- std::cout << std::endl << "Postorder:";
- postorder::for_each(bt.root(), to_cout);
+ std::cout << "Preorder:";
+ preorder::for_each(bt.root(), to_cout);
+
+ std::cout << std::endl << "Inorder:";
+ inorder::for_each(bt.root(), to_cout);
+
+ std::cout << std::endl << "Postorder:";
+ postorder::for_each(bt.root(), to_cout);
 
- return 0;
+ return 0;
 }
 //]
\ No newline at end of file

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_search_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_search_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_search_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -23,45 +23,45 @@
 
 void search_single_element(binary_tree<int>::const_cursor r, int v)
 {
- binary_tree<int>::const_cursor c, d;
- c = inorder::lower_bound(r, v);
- d = inorder::upper_bound(r, v);
-
- BOOST_CHECK(*c == v);
- //BOOST_CHECK(inorder::next(c) == d);
+ binary_tree<int>::const_cursor c, d;
+ c = inorder::lower_bound(r, v);
+ d = inorder::upper_bound(r, v);
+
+ BOOST_CHECK(*c == v);
+ //BOOST_CHECK(inorder::next(c) == d);
 }
 
 int test_main(int, char* [])
 {
- binary_tree<int> test_tree;
- create_test_data_tree(test_tree);
-
- binary_tree<int>::cursor c, d;
+ binary_tree<int> test_tree;
+ create_test_data_tree(test_tree);
+
+ binary_tree<int>::cursor c, d;
 
- search_single_element(test_tree.root(), 4); // (Left) Leaf
- search_single_element(test_tree.root(), 7); // (Right) Leaf
- search_single_element(test_tree.root(), 6); // Non-Leaf
- search_single_element(test_tree.root(), 8); // root().begin()
+ search_single_element(test_tree.root(), 4); // (Left) Leaf
+ search_single_element(test_tree.root(), 7); // (Right) Leaf
+ search_single_element(test_tree.root(), 6); // Non-Leaf
+ search_single_element(test_tree.root(), 8); // root().begin()
 
- c = inorder::lower_bound(test_tree.root(), 5); // Not in tree
- d = inorder::lower_bound(test_tree.root(), 5);
- BOOST_CHECK(*c == 6);
- BOOST_CHECK(*d == 6);
-
- *c = 4;
-
- c = inorder::lower_bound(test_tree.root(), 5); // Not in tree
- BOOST_CHECK(*c == 7);
+ c = inorder::lower_bound(test_tree.root(), 5); // Not in tree
+ d = inorder::lower_bound(test_tree.root(), 5);
+ BOOST_CHECK(*c == 6);
+ BOOST_CHECK(*d == 6);
+
+ *c = 4;
+
+ c = inorder::lower_bound(test_tree.root(), 5); // Not in tree
+ BOOST_CHECK(*c == 7);
 
- c = inorder::lower_bound(test_tree.root(), 4); // Twice in tree
- d = inorder::upper_bound(test_tree.root(), 4);
- BOOST_CHECK(*c == 4);
- BOOST_CHECK(*d == 7);
- BOOST_CHECK(*c.parent() == 4);
- //BOOST_CHECK(inorder::next(c, 2) == d);
-
- *c.to_parent() = 6;
- validate_test_data_tree(test_tree);
-
- return 0;
+ c = inorder::lower_bound(test_tree.root(), 4); // Twice in tree
+ d = inorder::upper_bound(test_tree.root(), 4);
+ BOOST_CHECK(*c == 4);
+ BOOST_CHECK(*d == 7);
+ BOOST_CHECK(*c.parent() == 4);
+ //BOOST_CHECK(inorder::next(c, 2) == d);
+
+ *c.to_parent() = 6;
+ validate_test_data_tree(test_tree);
+
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -20,196 +20,196 @@
 template <class Tree>
 void create_binary_tree(Tree& mytree)
 {
- typename Tree::cursor c, c1, c2, c3, c4;
-
- c = mytree.root();
-
- BOOST_CHECK(c.empty());
-
- c1 = mytree.insert(c, 1);
- BOOST_CHECK(*c1 == 1);
-
- BOOST_CHECK(!c.empty());
-
- BOOST_CHECK(c1.m_node->m_parent != 0);
- BOOST_CHECK(c1.m_node->m_parent != c1.m_node);
- BOOST_CHECK(c1.m_node->m_parent == c.m_node);
- BOOST_CHECK(c1.parent() == c);
-
- c2 = mytree.insert(c1, 2);
- BOOST_CHECK(!c.empty());
- BOOST_CHECK(c2.empty());
- BOOST_CHECK(*c1 == 1);
- BOOST_CHECK(*c2 == 2);
- *c1 = 14;
- BOOST_CHECK(*c1 == 14);
- BOOST_CHECK(*c2 == 2);
- BOOST_CHECK(c2.parent() == c1);
- BOOST_CHECK(c1.parent() == c);
-
- c3 = c1.end();
- BOOST_CHECK(c3 == c1.end());
- --c3;
- BOOST_CHECK(c3.parity() == 0);
- BOOST_CHECK(c3.parent() != c3);
- BOOST_CHECK(c3.parent() == c1);
- BOOST_CHECK(c3 == c1.begin());
-
- *c3 = 3;
- *(c1.begin()) = 2;
-
- BOOST_CHECK(*c3 == 2);
- ++c3;
- c4 = mytree.insert(c3, 4);
- BOOST_CHECK(*c4 == 4);
- c4 = c4.parent();
- --c4;
- BOOST_CHECK(*c4 == 2);
- BOOST_CHECK(c4.parent() == c1);
- c = boost::tree::inorder::lower_bound(mytree.root(), 2, std::less<int>());
- BOOST_CHECK(*c == 2);
- BOOST_CHECK(c4.empty());
-
- BOOST_CHECK(*c1 == 14);
-
- BOOST_CHECK(c1.begin().empty() || c1.end().empty());
-
- //c1 = mytree.erase(c1);
- //BOOST_CHECK(*c1 == 2);
+ typename Tree::cursor c, c1, c2, c3, c4;
+
+ c = mytree.root();
+
+ BOOST_CHECK(c.empty());
+
+ c1 = mytree.insert(c, 1);
+ BOOST_CHECK(*c1 == 1);
+
+ BOOST_CHECK(!c.empty());
+
+ BOOST_CHECK(c1.m_node->m_parent != 0);
+ BOOST_CHECK(c1.m_node->m_parent != c1.m_node);
+ BOOST_CHECK(c1.m_node->m_parent == c.m_node);
+ BOOST_CHECK(c1.parent() == c);
+
+ c2 = mytree.insert(c1, 2);
+ BOOST_CHECK(!c.empty());
+ BOOST_CHECK(c2.empty());
+ BOOST_CHECK(*c1 == 1);
+ BOOST_CHECK(*c2 == 2);
+ *c1 = 14;
+ BOOST_CHECK(*c1 == 14);
+ BOOST_CHECK(*c2 == 2);
+ BOOST_CHECK(c2.parent() == c1);
+ BOOST_CHECK(c1.parent() == c);
+
+ c3 = c1.end();
+ BOOST_CHECK(c3 == c1.end());
+ --c3;
+ BOOST_CHECK(c3.parity() == 0);
+ BOOST_CHECK(c3.parent() != c3);
+ BOOST_CHECK(c3.parent() == c1);
+ BOOST_CHECK(c3 == c1.begin());
+
+ *c3 = 3;
+ *(c1.begin()) = 2;
+
+ BOOST_CHECK(*c3 == 2);
+ ++c3;
+ c4 = mytree.insert(c3, 4);
+ BOOST_CHECK(*c4 == 4);
+ c4 = c4.parent();
+ --c4;
+ BOOST_CHECK(*c4 == 2);
+ BOOST_CHECK(c4.parent() == c1);
+ c = boost::tree::inorder::lower_bound(mytree.root(), 2, std::less<int>());
+ BOOST_CHECK(*c == 2);
+ BOOST_CHECK(c4.empty());
+
+ BOOST_CHECK(*c1 == 14);
+
+ BOOST_CHECK(c1.begin().empty() || c1.end().empty());
+
+ //c1 = mytree.erase(c1);
+ //BOOST_CHECK(*c1 == 2);
 
 }
 
 template <class Tree>
 void inorder_erase_test_data_tree(Tree& mytree)
 {
- typename Tree::cursor c = mytree.root().end().end().begin();
- BOOST_CHECK(*c == 14);
-
- c = c.parent().parent();
- BOOST_CHECK(*(c.begin()) == 10);
- BOOST_CHECK(c.begin().empty());
- BOOST_CHECK(!c.end().empty());
- BOOST_CHECK(*c.end().begin() == 14);
- c = c.begin();
-
- // Left child empty
- c = mytree.inorder_erase(c);
- BOOST_CHECK(*c == 11);
-
- ++c;
- BOOST_CHECK(*c.begin() == 12);
- BOOST_CHECK(c.begin().empty());
- BOOST_CHECK(c.end().empty());
- c = c.begin();
-
- // Both children empty
- c = mytree.inorder_erase(c);
- BOOST_CHECK(*c == 13);
+ typename Tree::cursor c = mytree.root().end().end().begin();
+ BOOST_CHECK(*c == 14);
+
+ c = c.parent().parent();
+ BOOST_CHECK(*(c.begin()) == 10);
+ BOOST_CHECK(c.begin().empty());
+ BOOST_CHECK(!c.end().empty());
+ BOOST_CHECK(*c.end().begin() == 14);
+ c = c.begin();
+
+ // Left child empty
+ c = mytree.inorder_erase(c);
+ BOOST_CHECK(*c == 11);
+
+ ++c;
+ BOOST_CHECK(*c.begin() == 12);
+ BOOST_CHECK(c.begin().empty());
+ BOOST_CHECK(c.end().empty());
+ c = c.begin();
+
+ // Both children empty
+ c = mytree.inorder_erase(c);
+ BOOST_CHECK(*c == 13);
 }
 
 template <class Tree>
 void destroy_binary_tree(Tree& mytree)
 {
- mytree.clear();
- BOOST_CHECK(mytree.empty());
+ mytree.clear();
+ BOOST_CHECK(mytree.empty());
 }
 
 template <class Tree>
 void validate_binary_tree(Tree const& mytree)
 {
- typename Tree::const_cursor c, c1, c2, c3, c4;
+ typename Tree::const_cursor c, c1, c2, c3, c4;
 
- c = mytree.root();
- BOOST_CHECK(!c.empty());
-
- c1 = c.begin();
- BOOST_CHECK(c1.parent() == c);
- BOOST_CHECK(*c1 == 14);
-
- c2 = c1.begin();
- BOOST_CHECK(c2.parent() == c1);
- BOOST_CHECK(*c2 == 2);
-
- c3 = c1.end();
- BOOST_CHECK(c3.parent() == c1);
- BOOST_CHECK(*c3.begin() == 4);
-
+ c = mytree.root();
+ BOOST_CHECK(!c.empty());
+
+ c1 = c.begin();
+ BOOST_CHECK(c1.parent() == c);
+ BOOST_CHECK(*c1 == 14);
+
+ c2 = c1.begin();
+ BOOST_CHECK(c2.parent() == c1);
+ BOOST_CHECK(*c2 == 2);
+
+ c3 = c1.end();
+ BOOST_CHECK(c3.parent() == c1);
+ BOOST_CHECK(*c3.begin() == 4);
+
 }
 
 template <class Tree>
 void test_swap_binary_trees(Tree& one, Tree& two)
 {
- using std::swap;
- swap(one, two);
+ using std::swap;
+ swap(one, two);
 }
 
 int test_main(int, char* [])
 {
- typedef binary_tree<int> tree_t;
- tree_t tree1, tree2;
-
- // Filling with test data.
- create_binary_tree(tree1);
- validate_binary_tree(tree1);
-
- // Swap tree1 with empty tree2
- test_swap_binary_trees(tree1, tree2);
- validate_binary_tree(tree2);
- BOOST_CHECK(tree1.empty());
-
- // Swap back
- test_swap_binary_trees(tree1, tree2);
- validate_binary_tree(tree1);
- BOOST_CHECK(tree2.empty());
-
- // Fill empty tree2 with different data
- create_test_data_tree(tree2);
- validate_test_data_tree(tree2);
- BOOST_CHECK(tree1 != tree2);
-
- // Swap
- test_swap_binary_trees(tree1, tree2);
- validate_test_data_tree(tree1);
- validate_binary_tree(tree2);
-
- destroy_binary_tree(tree2);
-
- // Insert subtree
- tree_t::cursor c = tree2.insert(tree2.root(), tree1.root());
- BOOST_CHECK(*c == 8);
- validate_test_data_tree(tree2);
-
- // Copy constructor
- tree_t tree3(tree2);
- validate_test_data_tree(tree3);
- BOOST_CHECK(tree2 == tree3);
-
- // Change one value in test_tree3
- c = tree3.root().begin().end().begin().begin();
- int tmp = *c;
- *c = tmp + 1;
- BOOST_CHECK(tree2 != tree3);
-
- // Change it back
- c = tree3.root().begin().end().begin().begin();
- *c = tmp;
- BOOST_CHECK(tree2 == tree3);
-
- c = tree3.inorder_first();
- BOOST_CHECK(*c == 1);
- c = tree3.root();
- //inorder::back(c);
- //BOOST_CHECK(*c == 14);
-
- destroy_binary_tree(tree2);
- tree2.splice(tree2.root(), tree3);
-
- BOOST_CHECK(tree3.empty());
- validate_test_data_tree(tree2);
- c = tree2.inorder_first();
- BOOST_CHECK(*c == 1);
-
- inorder_erase_test_data_tree(tree2);
-
- return 0;
+ typedef binary_tree<int> tree_t;
+ tree_t tree1, tree2;
+
+ // Filling with test data.
+ create_binary_tree(tree1);
+ validate_binary_tree(tree1);
+
+ // Swap tree1 with empty tree2
+ test_swap_binary_trees(tree1, tree2);
+ validate_binary_tree(tree2);
+ BOOST_CHECK(tree1.empty());
+
+ // Swap back
+ test_swap_binary_trees(tree1, tree2);
+ validate_binary_tree(tree1);
+ BOOST_CHECK(tree2.empty());
+
+ // Fill empty tree2 with different data
+ create_test_data_tree(tree2);
+ validate_test_data_tree(tree2);
+ BOOST_CHECK(tree1 != tree2);
+
+ // Swap
+ test_swap_binary_trees(tree1, tree2);
+ validate_test_data_tree(tree1);
+ validate_binary_tree(tree2);
+
+ destroy_binary_tree(tree2);
+
+ // Insert subtree
+ tree_t::cursor c = tree2.insert(tree2.root(), tree1.root());
+ BOOST_CHECK(*c == 8);
+ validate_test_data_tree(tree2);
+
+ // Copy constructor
+ tree_t tree3(tree2);
+ validate_test_data_tree(tree3);
+ BOOST_CHECK(tree2 == tree3);
+
+ // Change one value in test_tree3
+ c = tree3.root().begin().end().begin().begin();
+ int tmp = *c;
+ *c = tmp + 1;
+ BOOST_CHECK(tree2 != tree3);
+
+ // Change it back
+ c = tree3.root().begin().end().begin().begin();
+ *c = tmp;
+ BOOST_CHECK(tree2 == tree3);
+
+ c = tree3.inorder_first();
+ BOOST_CHECK(*c == 1);
+ c = tree3.root();
+ //inorder::back(c);
+ //BOOST_CHECK(*c == 14);
+
+ destroy_binary_tree(tree2);
+ tree2.splice(tree2.root(), tree3);
+
+ BOOST_CHECK(tree3.empty());
+ validate_test_data_tree(tree2);
+ c = tree2.inorder_first();
+ BOOST_CHECK(*c == 1);
+
+ inorder_erase_test_data_tree(tree2);
+
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -38,26 +38,26 @@
 
 int test_main(int, char* [])
 {
- using boost::forward_traversal_tag;
-
- binary_tree<int> test_tree, test_tree2;
- create_test_data_tree(test_tree);
- create_test_data_tree(test_tree2);
-
- binary_tree<int>::cursor c = test_tree.root();
- binary_tree<int>::cursor d = test_tree2.root();
+ using boost::forward_traversal_tag;
+
+ binary_tree<int> test_tree, test_tree2;
+ create_test_data_tree(test_tree);
+ create_test_data_tree(test_tree2);
+
+ binary_tree<int>::cursor c = test_tree.root();
+ binary_tree<int>::cursor d = test_tree2.root();
 
- // Just to make sure we won't be getting any false positives when
- // copying test_tree1 to test_tree2, we'll change one of test_tree2's
- // values.
- d = d.begin().end().begin().begin();
- ++*d;
- BOOST_CHECK(test_tree != test_tree2);
- d = test_tree2.root();
+ // Just to make sure we won't be getting any false positives when
+ // copying test_tree1 to test_tree2, we'll change one of test_tree2's
+ // values.
+ d = d.begin().end().begin().begin();
+ ++*d;
+ BOOST_CHECK(test_tree != test_tree2);
+ d = test_tree2.root();
 
- test::preorder::algorithms (test_tree.root(), test_tree2.root());
- test::inorder::algorithms (test_tree.root(), test_tree2.root());
- test::postorder::algorithms(test_tree.root(), test_tree2.root());
+ test::preorder::algorithms (test_tree.root(), test_tree2.root());
+ test::inorder::algorithms (test_tree.root(), test_tree2.root());
+ test::postorder::algorithms(test_tree.root(), test_tree2.root());
 
- return 0;
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -23,90 +23,90 @@
 
 void test_forest_tree()
 {
- using namespace boost::tree;
-
- typedef forest_tree<int> tree_type;
- tree_type mytree;
-
- tree_type::cursor c = mytree.root();
- c = mytree.insert(c, 6);
- BOOST_CHECK(*c == 6);
-
- c = mytree.insert(c, 5);
- BOOST_CHECK(*c == 5);
-
- c = mytree.insert(c, 4);
- BOOST_CHECK(*c == 4);
- BOOST_CHECK(c == mytree.root().begin());
-
- ++c;
- BOOST_CHECK(*c == 5);
- ++c;
- BOOST_CHECK(*c == 6);
-
- tree_type forest;
- //create_test_data_tree(forest);
- c = forest.insert(forest.root(), 8);
- BOOST_CHECK(c == forest.root().begin());
- BOOST_CHECK(*c == 8);
- c = forest.insert(c, 3);
- BOOST_CHECK(*c == 3);
- BOOST_CHECK(*++c == 8);
-// BOOST_CHECK(*forest.root().begin().begin() == 3);
+ using namespace boost::tree;
+
+ typedef forest_tree<int> tree_type;
+ tree_type mytree;
+
+ tree_type::cursor c = mytree.root();
+ c = mytree.insert(c, 6);
+ BOOST_CHECK(*c == 6);
+
+ c = mytree.insert(c, 5);
+ BOOST_CHECK(*c == 5);
+
+ c = mytree.insert(c, 4);
+ BOOST_CHECK(*c == 4);
+ BOOST_CHECK(c == mytree.root().begin());
+
+ ++c;
+ BOOST_CHECK(*c == 5);
+ ++c;
+ BOOST_CHECK(*c == 6);
+
+ tree_type forest;
+ //create_test_data_tree(forest);
+ c = forest.insert(forest.root(), 8);
+ BOOST_CHECK(c == forest.root().begin());
+ BOOST_CHECK(*c == 8);
+ c = forest.insert(c, 3);
+ BOOST_CHECK(*c == 3);
+ BOOST_CHECK(*++c == 8);
+// BOOST_CHECK(*forest.root().begin().begin() == 3);
 
 }
 
 void test_natural_correspondence()
 {
- using namespace boost::tree;
-
- typedef binary_tree<int> binary_tree_type;
- binary_tree_type bt;
- create_test_data_tree(bt);
-
- typedef forest_tree<int> forest_tree_type;
- forest_tree_type ft(bt);
-
- validate_corresponding_forest_tree(ft);
-
- // Now test *order correspondence:
- // forest binary
- // pre pre
- // post in
- std::list<int> test_list;
- typedef std::back_insert_iterator< std::list<int> > back_insert_iter_list_int;
- typedef output_cursor_iterator_wrapper<back_insert_iter_list_int> oc_bi_lst_type;
- back_insert_iter_list_int it_test_list = std::back_inserter(test_list);
- oc_bi_lst_type oc_test_list = oc_bi_lst_type(it_test_list);
-
- boost::tree::preorder::for_each(
- ft.root(),
- boost::lambda::bind(&std::list<int>::push_back, &test_list, boost::lambda::_1)
- );
- test::preorder::traversal(test_list.begin(), test_list.end());
- BOOST_CHECK(test_list.size() == 11);
- test_list.clear();
-
- boost::tree::preorder::copy(ft.root(), oc_test_list);
- test::preorder::traversal(test_list.begin(), test_list.end());
- BOOST_CHECK(test_list.size() == 11);
- test_list.clear();
-
- boost::tree::preorder::transform(ft.root(), oc_test_list, std::bind2nd(std::plus<int>(),0));
- test::preorder::traversal(test_list.begin(), test_list.end());
- BOOST_CHECK(test_list.size() == 11);
- test_list.clear();
-
- //test::preorder::algorithms(ft.root(), ft.root()); // FIXME: Fix algorithms for use in here.
-
- //boost::tree::postorder::copy(ft.root(), oc_test_list);
- //test::inorder::traversal(test_list.begin(), test_list.end());
- //BOOST_CHECK(test_list.size() == 11);
+ using namespace boost::tree;
+
+ typedef binary_tree<int> binary_tree_type;
+ binary_tree_type bt;
+ create_test_data_tree(bt);
+
+ typedef forest_tree<int> forest_tree_type;
+ forest_tree_type ft(bt);
+
+ validate_corresponding_forest_tree(ft);
+
+ // Now test *order correspondence:
+ // forest binary
+ // pre pre
+ // post in
+ std::list<int> test_list;
+ typedef std::back_insert_iterator< std::list<int> > back_insert_iter_list_int;
+ typedef output_cursor_iterator_wrapper<back_insert_iter_list_int> oc_bi_lst_type;
+ back_insert_iter_list_int it_test_list = std::back_inserter(test_list);
+ oc_bi_lst_type oc_test_list = oc_bi_lst_type(it_test_list);
+
+ boost::tree::preorder::for_each(
+ ft.root(),
+ boost::lambda::bind(&std::list<int>::push_back, &test_list, boost::lambda::_1)
+ );
+ test::preorder::traversal(test_list.begin(), test_list.end());
+ BOOST_CHECK(test_list.size() == 11);
+ test_list.clear();
+
+ boost::tree::preorder::copy(ft.root(), oc_test_list);
+ test::preorder::traversal(test_list.begin(), test_list.end());
+ BOOST_CHECK(test_list.size() == 11);
+ test_list.clear();
+
+ boost::tree::preorder::transform(ft.root(), oc_test_list, std::bind2nd(std::plus<int>(),0));
+ test::preorder::traversal(test_list.begin(), test_list.end());
+ BOOST_CHECK(test_list.size() == 11);
+ test_list.clear();
+
+ //test::preorder::algorithms(ft.root(), ft.root()); // FIXME: Fix algorithms for use in here.
+
+ //boost::tree::postorder::copy(ft.root(), oc_test_list);
+ //test::inorder::traversal(test_list.begin(), test_list.end());
+ //BOOST_CHECK(test_list.size() == 11);
 }
 
 int test_main(int, char* [])
 {
- test_forest_tree();
- test_natural_correspondence();
- return 0;
+ test_forest_tree();
+ test_natural_correspondence();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/graph_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/graph_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/graph_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -19,100 +19,100 @@
 
 int test_main(int, char* [])
 {
- using namespace boost;
- using boost::tree::binary_tree;
-
- typedef color_traits<default_color_type> Color;
- typedef augmented_type< int, boost::default_color_type > data_type;
-
- typedef binary_tree< data_type > tree_type;
- typedef tree_type::cursor cursor;
-
- tree_type test_tree;
- create_test_data_tree(test_tree);
-
- std::list<int> test_list;
- typedef std::back_insert_iterator< std::list<int> > bi_list_int_type;
- bi_list_int_type bi_list_int = std::back_inserter(test_list);
+ using namespace boost;
+ using boost::tree::binary_tree;
+
+ typedef color_traits<default_color_type> Color;
+ typedef augmented_type< int, boost::default_color_type > data_type;
+
+ typedef binary_tree< data_type > tree_type;
+ typedef tree_type::cursor cursor;
+
+ tree_type test_tree;
+ create_test_data_tree(test_tree);
+
+ std::list<int> test_list;
+ typedef std::back_insert_iterator< std::list<int> > bi_list_int_type;
+ bi_list_int_type bi_list_int = std::back_inserter(test_list);
 
- // TODO:
+ // TODO:
 
- // Wrap a BGL (Incidence)Graph around test_tree
-
- // Traverse the Graph and check if the result is equal
- // to the test data sets, using the depth_first_visit algorithm and
- // a visitor that is invoked at entering (preorder)
- // the vertices.
+ // Wrap a BGL (Incidence)Graph around test_tree
+
+ // Traverse the Graph and check if the result is equal
+ // to the test data sets, using the depth_first_visit algorithm and
+ // a visitor that is invoked at entering (preorder)
+ // the vertices.
 
- boost::extract_property_map<
- cursor,
- boost::tree::cursor_value<cursor>::type::extract_data
- > dpm;
-
- boost::extract_property_map<
- cursor,
- boost::tree::cursor_value<cursor>::type::extract_meta
- > cpm;
+ boost::extract_property_map<
+ cursor,
+ boost::tree::cursor_value<cursor>::type::extract_data
+ > dpm;
+
+ boost::extract_property_map<
+ cursor,
+ boost::tree::cursor_value<cursor>::type::extract_meta
+ > cpm;
 
- BOOST_CHECK(get(dpm, test_tree.root()) == 8); // Check the entire tree?
- BOOST_CHECK(get(cpm, test_tree.root()) == Color::white());
-
- put(cpm, test_tree.root(), Color::gray());
- BOOST_CHECK(get(cpm, test_tree.root()) == Color::gray());
- put(cpm, test_tree.root(), Color::white());
- BOOST_CHECK(get(cpm, test_tree.root()) == Color::white());
-
- boost::dfs_visitor<
- boost::property_writer<
- boost::extract_property_map<
- cursor,
- boost::tree::cursor_value<cursor>::type::extract_data
- >,
- bi_list_int_type,
- boost::on_discover_vertex>
- >
- preorder_writer(write_property(dpm, bi_list_int,
- boost::on_discover_vertex()));
-
-// boost::depth_first_visit(test_tree, test_tree.root(), preorder_writer, cpm, empty_cursor<tree_type>);
-
- graph_traits<tree_type>::vertex_descriptor v = test_tree.root();
-
- graph_traits<tree_type>::out_edge_iterator oei, oei_end;
- tie(oei, oei_end) = out_edges(v, test_tree);
-
- cursor w = target(*oei, test_tree);
-
- w = test_tree.root().begin().end().begin();
- default_color_type color = get(cpm, w);
- BOOST_CHECK(color == Color::white());
-
- put(cpm, w, Color::white());
- BOOST_CHECK(get(cpm, w) == Color::white());
-
- BOOST_CHECK(!empty_cursor(v, test_tree));
-
- BOOST_CHECK(oei != oei_end);
-
- BOOST_CHECK(source(*oei, test_tree) == test_tree.root());
- BOOST_CHECK(source(*oei_end, test_tree) == test_tree.root());
-
- BOOST_CHECK(target(*oei, test_tree) == test_tree.root().begin());
- BOOST_CHECK(target(*oei_end, test_tree) == test_tree.root());
-
- BOOST_CHECK(out_degree(v, test_tree) == 2);
-//
-// BOOST_CHECK(test_list.size() == 2);
-//
-// std::list<int>::const_iterator ci = test_list.begin();
-//
-// BOOST_CHECK(*ci == 8);
-// BOOST_CHECK(*++ci == 10); //FIXME
-
-// test::preorder::traversal(test_list.begin(), test_list.end());
-
- // Output test_tree using write_graphviz. This might require copying
- // the IncidenceGraph to a VertexListGraph (using copy_component)
-
- return 0;
+ BOOST_CHECK(get(dpm, test_tree.root()) == 8); // Check the entire tree?
+ BOOST_CHECK(get(cpm, test_tree.root()) == Color::white());
+
+ put(cpm, test_tree.root(), Color::gray());
+ BOOST_CHECK(get(cpm, test_tree.root()) == Color::gray());
+ put(cpm, test_tree.root(), Color::white());
+ BOOST_CHECK(get(cpm, test_tree.root()) == Color::white());
+
+ boost::dfs_visitor<
+ boost::property_writer<
+ boost::extract_property_map<
+ cursor,
+ boost::tree::cursor_value<cursor>::type::extract_data
+ >,
+ bi_list_int_type,
+ boost::on_discover_vertex>
+ >
+ preorder_writer(write_property(dpm, bi_list_int,
+ boost::on_discover_vertex()));
+
+// boost::depth_first_visit(test_tree, test_tree.root(), preorder_writer, cpm, empty_cursor<tree_type>);
+
+ graph_traits<tree_type>::vertex_descriptor v = test_tree.root();
+
+ graph_traits<tree_type>::out_edge_iterator oei, oei_end;
+ tie(oei, oei_end) = out_edges(v, test_tree);
+
+ cursor w = target(*oei, test_tree);
+
+ w = test_tree.root().begin().end().begin();
+ default_color_type color = get(cpm, w);
+ BOOST_CHECK(color == Color::white());
+
+ put(cpm, w, Color::white());
+ BOOST_CHECK(get(cpm, w) == Color::white());
+
+ BOOST_CHECK(!empty_cursor(v, test_tree));
+
+ BOOST_CHECK(oei != oei_end);
+
+ BOOST_CHECK(source(*oei, test_tree) == test_tree.root());
+ BOOST_CHECK(source(*oei_end, test_tree) == test_tree.root());
+
+ BOOST_CHECK(target(*oei, test_tree) == test_tree.root().begin());
+ BOOST_CHECK(target(*oei_end, test_tree) == test_tree.root());
+
+ BOOST_CHECK(out_degree(v, test_tree) == 2);
+//
+// BOOST_CHECK(test_list.size() == 2);
+//
+// std::list<int>::const_iterator ci = test_list.begin();
+//
+// BOOST_CHECK(*ci == 8);
+// BOOST_CHECK(*++ci == 10); //FIXME
+
+// test::preorder::traversal(test_list.begin(), test_list.end());
+
+ // Output test_tree using write_graphviz. This might require copying
+ // the IncidenceGraph to a VertexListGraph (using copy_component)
+
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/helpers.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/helpers.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/helpers.hpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -19,76 +19,76 @@
 
 
 /**
- * @brief test_balancer (exposes underlying hierarchy for test purposes)
+ * @brief test_balancer (exposes underlying hierarchy for test purposes)
  */
 // TODO: Ctor, dtors
 template <class Hier, class Balance>
 struct test_balancer
  : public balanced_tree<Hier, Balance> {
-
- typedef typename balanced_tree<Hier, Balance>::hierarchy_type hierarchy_type;
-
- explicit test_balancer(hierarchy_type const& hier = hierarchy_type())
- : balanced_tree<Hier, Balance>(hier)
- {}
-
- hierarchy_type& hierarchy()
- {
- return this->h;
- }
+
+ typedef typename balanced_tree<Hier, Balance>::hierarchy_type hierarchy_type;
+
+ explicit test_balancer(hierarchy_type const& hier = hierarchy_type())
+ : balanced_tree<Hier, Balance>(hier)
+ {}
+
+ hierarchy_type& hierarchy()
+ {
+ return this->h;
+ }
 };
 
 /**
- * @brief test_searcher (exposes underlying container for test purposes)
+ * @brief test_searcher (exposes underlying container for test purposes)
  */
 // TODO: Ctor, dtors
 template <bool Multi, class Sortable, class Extract =
- boost::multi_index::identity<typename Sortable::value_type>,
- class Compare = std::less<typename Extract::result_type> >
+ boost::multi_index::identity<typename Sortable::value_type>,
+ class Compare = std::less<typename Extract::result_type> >
 struct test_searcher
  : public searcher<Multi, Sortable, Extract, Compare> {
-// Sortable&
- typename Sortable::hierarchy_type::template rebind<typename Sortable::value_type>::other&
+// Sortable&
+ typename Sortable::hierarchy_type::template rebind<typename Sortable::value_type>::other&
 
- container()
- {
- return this->c;
- }
+ container()
+ {
+ return this->c;
+ }
 };
 
 
 template <class Searcher>
 void create_test_data_searcher(Searcher& my_tree)
 {
- my_tree.insert(8);
- my_tree.insert(10);
- my_tree.insert(14);
- my_tree.insert(13);
- my_tree.insert(11);
- my_tree.insert(12);
-
- my_tree.insert(3);
- my_tree.insert(1);
- my_tree.insert(6);
- my_tree.insert(4);
- my_tree.insert(7);
+ my_tree.insert(8);
+ my_tree.insert(10);
+ my_tree.insert(14);
+ my_tree.insert(13);
+ my_tree.insert(11);
+ my_tree.insert(12);
+
+ my_tree.insert(3);
+ my_tree.insert(1);
+ my_tree.insert(6);
+ my_tree.insert(4);
+ my_tree.insert(7);
 }
 
 template <class Searcher>
 void create_test_data_sequence(Searcher& my_tree)
 {
- my_tree.push_back(8);
- my_tree.push_back(10);
- my_tree.push_back(14);
- my_tree.push_back(13);
- my_tree.push_back(11);
- my_tree.push_back(12);
-
- my_tree.push_back(3);
- my_tree.push_back(1);
- my_tree.push_back(6);
- my_tree.push_back(4);
- my_tree.push_back(7);
+ my_tree.push_back(8);
+ my_tree.push_back(10);
+ my_tree.push_back(14);
+ my_tree.push_back(13);
+ my_tree.push_back(11);
+ my_tree.push_back(12);
+
+ my_tree.push_back(3);
+ my_tree.push_back(1);
+ my_tree.push_back(6);
+ my_tree.push_back(4);
+ my_tree.push_back(7);
 }
 
 #endif // LIBS_TREE_TEST_HELPERS_HPP

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/interval_search_binary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/interval_search_binary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/interval_search_binary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -29,42 +29,42 @@
 
 template <typename T>
 struct cerless {
- inline bool operator() (T const& a, T const& b)
- {
- return boost::numeric::interval_lib::cerlt(a,b);
- }
+ inline bool operator() (T const& a, T const& b)
+ {
+ return boost::numeric::interval_lib::cerlt(a,b);
+ }
 };
 
 void test_interval_search_binary_tree()
 {
- using boost::tree::searcher;
- using boost::tree::binary_tree;
-
- using boost::multi_index::identity;
-
- typedef searcher<false, binary_tree<interval<int> >, identity<interval<int> >,
- cerless<interval<int> > > searcher_t;
- searcher_t my_tree;
-
- my_tree.insert(interval<int>(20,36));
- my_tree.insert(interval<int>( 3,41));
- my_tree.insert(interval<int>(10,15));
- my_tree.insert(interval<int>( 0, 1));
- my_tree.insert(interval<int>(29,99));
+ using boost::tree::searcher;
+ using boost::tree::binary_tree;
+
+ using boost::multi_index::identity;
+
+ typedef searcher<false, binary_tree<interval<int> >, identity<interval<int> >,
+ cerless<interval<int> > > searcher_t;
+ searcher_t my_tree;
+
+ my_tree.insert(interval<int>(20,36));
+ my_tree.insert(interval<int>( 3,41));
+ my_tree.insert(interval<int>(10,15));
+ my_tree.insert(interval<int>( 0, 1));
+ my_tree.insert(interval<int>(29,99));
 
- searcher_t::iterator ci = my_tree.begin();
- BOOST_CHECK(*ci++ == interval<int>( 0, 1));
-// BOOST_CHECK(*ci++ == interval<int>( 3,41));
- BOOST_CHECK(*ci++ == interval<int>(10,15));
-// BOOST_CHECK(*ci++ == interval<int>(20,36));
-// BOOST_CHECK(*ci++ == interval<int>(29,99));
-// BOOST_CHECK(ci == my_tree.end());
-
+ searcher_t::iterator ci = my_tree.begin();
+ BOOST_CHECK(*ci++ == interval<int>( 0, 1));
+// BOOST_CHECK(*ci++ == interval<int>( 3,41));
+ BOOST_CHECK(*ci++ == interval<int>(10,15));
+// BOOST_CHECK(*ci++ == interval<int>(20,36));
+// BOOST_CHECK(*ci++ == interval<int>(29,99));
+// BOOST_CHECK(ci == my_tree.end());
+
 }
 
 
 int test_main(int, char* [])
 {
- test_interval_search_binary_tree();
- return 0;
+ test_interval_search_binary_tree();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -5,8 +5,8 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 //TODO: Make this a test suite.
-// Add iterator traversal tests - check if proper overloads (if present)
-// are used.
+// Add iterator traversal tests - check if proper overloads (if present)
+// are used.
 
 // TODO: get timings. that makes that no testcase anymore, right?
 //does boost have timers? what does the austern et al one look like?
@@ -48,45 +48,45 @@
 template <class Cursor, class Op>
 void underefed_for_each_recursive(Cursor s, Op& f)
 {
- Cursor t = s.end();
- f(s); // Caution: f(s) comes before s.to_begin(), as opposed to
- s.to_begin(); // "normal" preorder for_each
- do
- if (!s.empty())
- underefed_for_each_recursive(s, f);
- while (s++ != t);
+ Cursor t = s.end();
+ f(s); // Caution: f(s) comes before s.to_begin(), as opposed to
+ s.to_begin(); // "normal" preorder for_each
+ do
+ if (!s.empty())
+ underefed_for_each_recursive(s, f);
+ while (s++ != t);
 }
 
 template <class Cursor, class Op>
 Op underefed_for_each(Cursor s, Op f)
 {
- Cursor t = s.end();
- f(s); // Caution: f(s) comes before s.to_begin(), as opposed to
- s.to_begin(); // "normal" preorder for_each
- do
- if (!s.empty())
- underefed_for_each_recursive(s, f);
- while (s++ != t);
+ Cursor t = s.end();
+ f(s); // Caution: f(s) comes before s.to_begin(), as opposed to
+ s.to_begin(); // "normal" preorder for_each
+ do
+ if (!s.empty())
+ underefed_for_each_recursive(s, f);
+ while (s++ != t);
 
- return f;
+ return f;
 }
 
 template <class Cursor>
 void comparisons(Cursor c) {
- test::preorder::compare_cursor_to_iterator_traversal(c);
- test::inorder::compare_cursor_to_iterator_traversal(c);
- test::postorder::compare_cursor_to_iterator_traversal(c);
- return;
+ test::preorder::compare_cursor_to_iterator_traversal(c);
+ test::inorder::compare_cursor_to_iterator_traversal(c);
+ test::postorder::compare_cursor_to_iterator_traversal(c);
+ return;
 }
 
 void comparisons_using_ac(binary_tree<int>::cursor c) {
- comparisons(make_root_tracking_cursor(make_ascending_cursor(c)));
- return;
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(c)));
+ return;
 }
 
 void comparisons_using_rtc(binary_tree<int>::cursor c) {
- comparisons(make_root_tracking_cursor(c));
- return;
+ comparisons(make_root_tracking_cursor(c));
+ return;
 }
 
 /**
@@ -99,134 +99,134 @@
  * "explicit stack"-based cursors also.
  */
 void compare_cursor_to_iterator_traversal() {
- binary_tree<int> test_tree2;
- //comparisons(test_tree2.root());
+ binary_tree<int> test_tree2;
+ //comparisons(test_tree2.root());
 
- binary_tree<int>::cursor c = test_tree2.insert(test_tree2.root(), 8);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- c = test_tree2.insert(c, 3);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- test_tree2.insert(c, 1);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- c = test_tree2.insert(++c, 6);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- test_tree2.insert(c, 4);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- test_tree2.insert(++c, 7);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- c = test_tree2.insert(test_tree2.root().end(), 10);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- c = test_tree2.insert(test_tree2.root().end().end(), 14);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- c = test_tree2.insert(c, 13);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- c = test_tree2.insert(c, 11);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- c = test_tree2.insert(++c, 12);
- comparisons(make_root_tracking_cursor(test_tree2.root()));
- comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
-
- underefed_for_each(test_tree2.root(), comparisons_using_ac);
- underefed_for_each(test_tree2.root(), comparisons_using_rtc);
+ binary_tree<int>::cursor c = test_tree2.insert(test_tree2.root(), 8);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ c = test_tree2.insert(c, 3);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ test_tree2.insert(c, 1);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ c = test_tree2.insert(++c, 6);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ test_tree2.insert(c, 4);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ test_tree2.insert(++c, 7);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ c = test_tree2.insert(test_tree2.root().end(), 10);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ c = test_tree2.insert(test_tree2.root().end().end(), 14);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ c = test_tree2.insert(c, 13);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ c = test_tree2.insert(c, 11);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ c = test_tree2.insert(++c, 12);
+ comparisons(make_root_tracking_cursor(test_tree2.root()));
+ comparisons(make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+
+ underefed_for_each(test_tree2.root(), comparisons_using_ac);
+ underefed_for_each(test_tree2.root(), comparisons_using_rtc);
 }
 
 int test_main(int, char* [])
 {
- typedef boost::tree::binary_tree<int>::cursor cursor;
-
- binary_tree<int> test_tree;
-// std::list<int> test_list;
-//
-// // TODO: Put this into a better testing context.
-// boost::tree::preorder::for_each(
-// test_tree.root(),
-// boost::lambda::bind(&std::list<int>::push_back, &test_list, boost::lambda::_1)
-// );
-// BOOST_CHECK(test_list.empty());
-
- create_test_data_tree(test_tree);
-
- //Preorder
- test::preorder::traversal(preorder::begin(make_root_tracking_cursor(test_tree.root())),
- preorder::end(make_root_tracking_cursor(test_tree.root())));
-
- test::preorder::reverse_traversal(preorder::end(make_root_tracking_cursor(test_tree.root())),
- preorder::begin(make_root_tracking_cursor(test_tree.root())));
-
- BOOST_CHECK(std::distance(preorder::begin(make_root_tracking_cursor(test_tree.root())),
- preorder::end(make_root_tracking_cursor(test_tree.root()))) == 11);
-
- // Inorder
- test::inorder::traversal(inorder::begin(make_root_tracking_cursor(test_tree.root())),
- inorder::end(make_root_tracking_cursor(test_tree.root())));
-
- test::inorder::reverse_traversal(inorder::end(make_root_tracking_cursor(test_tree.root())),
- inorder::begin(make_root_tracking_cursor(test_tree.root())));
-
- // TODO: Also check with binary_tree-specialized inorder begin()!
-
- BOOST_CHECK(std::distance(inorder::begin(make_root_tracking_cursor(test_tree.root())),
- inorder::end(make_root_tracking_cursor(test_tree.root()))) == 11);
-
- //Postorder
- test::postorder::traversal(postorder::begin(make_root_tracking_cursor(test_tree.root())),
- postorder::end(make_root_tracking_cursor(test_tree.root())));
- test::postorder::reverse_traversal(postorder::end(make_root_tracking_cursor(test_tree.root())),
- postorder::begin(make_root_tracking_cursor(test_tree.root())));
-
- BOOST_CHECK(std::distance(postorder::begin(make_root_tracking_cursor(test_tree.root())),
- postorder::end(make_root_tracking_cursor(test_tree.root()))) == 11);
-
- // Now the iterators based on stack-based cursors (that don't use cursor.to_parent())
-
- test::preorder::traversal(preorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
- preorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
- test::preorder::reverse_traversal(preorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
- preorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
-
- test::inorder::traversal(inorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
- inorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
- test::inorder::reverse_traversal(inorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
- inorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
-
- test::postorder::traversal(postorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
- postorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
- test::postorder::reverse_traversal(postorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
- postorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
-
- //Ascending iterator.
- binary_tree<int>::cursor c = test_tree.root();
- ascending::iterator<binary_tree<int>::cursor> ai_root(c);
- c = c.begin().end().begin().begin();
- BOOST_CHECK(*c == 4);
-
- ascending::iterator<binary_tree<int>::cursor> ais(c);
- test::ascending::traversal_from_leaf4(ais, ai_root);
-
- //Now the advanced stuff
- compare_cursor_to_iterator_traversal();
-
- return 0;
+ typedef boost::tree::binary_tree<int>::cursor cursor;
+
+ binary_tree<int> test_tree;
+// std::list<int> test_list;
+//
+// // TODO: Put this into a better testing context.
+// boost::tree::preorder::for_each(
+// test_tree.root(),
+// boost::lambda::bind(&std::list<int>::push_back, &test_list, boost::lambda::_1)
+// );
+// BOOST_CHECK(test_list.empty());
+
+ create_test_data_tree(test_tree);
+
+ //Preorder
+ test::preorder::traversal(preorder::begin(make_root_tracking_cursor(test_tree.root())),
+ preorder::end(make_root_tracking_cursor(test_tree.root())));
+
+ test::preorder::reverse_traversal(preorder::end(make_root_tracking_cursor(test_tree.root())),
+ preorder::begin(make_root_tracking_cursor(test_tree.root())));
+
+ BOOST_CHECK(std::distance(preorder::begin(make_root_tracking_cursor(test_tree.root())),
+ preorder::end(make_root_tracking_cursor(test_tree.root()))) == 11);
+
+ // Inorder
+ test::inorder::traversal(inorder::begin(make_root_tracking_cursor(test_tree.root())),
+ inorder::end(make_root_tracking_cursor(test_tree.root())));
+
+ test::inorder::reverse_traversal(inorder::end(make_root_tracking_cursor(test_tree.root())),
+ inorder::begin(make_root_tracking_cursor(test_tree.root())));
+
+ // TODO: Also check with binary_tree-specialized inorder begin()!
+
+ BOOST_CHECK(std::distance(inorder::begin(make_root_tracking_cursor(test_tree.root())),
+ inorder::end(make_root_tracking_cursor(test_tree.root()))) == 11);
+
+ //Postorder
+ test::postorder::traversal(postorder::begin(make_root_tracking_cursor(test_tree.root())),
+ postorder::end(make_root_tracking_cursor(test_tree.root())));
+ test::postorder::reverse_traversal(postorder::end(make_root_tracking_cursor(test_tree.root())),
+ postorder::begin(make_root_tracking_cursor(test_tree.root())));
+
+ BOOST_CHECK(std::distance(postorder::begin(make_root_tracking_cursor(test_tree.root())),
+ postorder::end(make_root_tracking_cursor(test_tree.root()))) == 11);
+
+ // Now the iterators based on stack-based cursors (that don't use cursor.to_parent())
+
+ test::preorder::traversal(preorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
+ preorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
+ test::preorder::reverse_traversal(preorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
+ preorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
+
+ test::inorder::traversal(inorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
+ inorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
+ test::inorder::reverse_traversal(inorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
+ inorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
+
+ test::postorder::traversal(postorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
+ postorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
+ test::postorder::reverse_traversal(postorder::end(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
+ postorder::begin(make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
+
+ //Ascending iterator.
+ binary_tree<int>::cursor c = test_tree.root();
+ ascending::iterator<binary_tree<int>::cursor> ai_root(c);
+ c = c.begin().end().begin().begin();
+ BOOST_CHECK(*c == 4);
+
+ ascending::iterator<binary_tree<int>::cursor> ais(c);
+ test::ascending::traversal_from_leaf4(ais, ai_root);
+
+ //Now the advanced stuff
+ compare_cursor_to_iterator_traversal();
+
+ return 0;
 }
 
 

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/key_search_binary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/key_search_binary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/key_search_binary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -19,155 +19,155 @@
 
 void test_key_search_binary_tree()
 {
- using namespace boost::tree;
-
- typedef test_searcher<false, balanced_tree<binary_tree<int>, balancers::unbalanced> > searcher_t;
- searcher_t my_tree;
-
- searcher_t::iterator c, c1, c2, c3, c4, c5;
- //std::pair<searcher_t::iterator, std::pair<bool, bool> > ret;
-
- c = my_tree.end();
- BOOST_CHECK(c == my_tree.end());
- BOOST_CHECK(c == my_tree.begin());
-
-// searcher_t::cursor cur = searcher_t::cursor(c);
-// BOOST_CHECK(cur.empty());
-// BOOST_CHECK(cur == searcher_t::cursor(my_tree.end()));
-
- c1 = my_tree.insert(c, 8);
-
- BOOST_CHECK(*c1 == 8);
-// BOOST_CHECK(searcher_t::cursor(c1).parity() == 0);
- BOOST_CHECK(c != my_tree.end());
- BOOST_CHECK(c1 != my_tree.end());
-
-// cur = searcher_t::cursor(c1);
-// BOOST_CHECK((++cur).empty());
-// BOOST_CHECK(cur.parity());
-//
-// cur = cur.parent(); //header-cursor(,1) (root)
-// BOOST_CHECK(!cur.parity());
-// BOOST_CHECK(searcher_t::iterator(cur) == my_tree.end());
- BOOST_CHECK(*c1 = 8);
-
- BOOST_CHECK(++c1 == my_tree.end());
-
-
- --c1;
- BOOST_CHECK(*c1 == 8);
-
-// BOOST_CHECK(searcher_t::cursor(my_tree.end()).parity() == 1);
+ using namespace boost::tree;
+
+ typedef test_searcher<false, balanced_tree<binary_tree<int>, balancers::unbalanced> > searcher_t;
+ searcher_t my_tree;
+
+ searcher_t::iterator c, c1, c2, c3, c4, c5;
+ //std::pair<searcher_t::iterator, std::pair<bool, bool> > ret;
+
+ c = my_tree.end();
+ BOOST_CHECK(c == my_tree.end());
+ BOOST_CHECK(c == my_tree.begin());
+
+// searcher_t::cursor cur = searcher_t::cursor(c);
+// BOOST_CHECK(cur.empty());
+// BOOST_CHECK(cur == searcher_t::cursor(my_tree.end()));
+
+ c1 = my_tree.insert(c, 8);
+
+ BOOST_CHECK(*c1 == 8);
+// BOOST_CHECK(searcher_t::cursor(c1).parity() == 0);
+ BOOST_CHECK(c != my_tree.end());
+ BOOST_CHECK(c1 != my_tree.end());
+
+// cur = searcher_t::cursor(c1);
+// BOOST_CHECK((++cur).empty());
+// BOOST_CHECK(cur.parity());
+//
+// cur = cur.parent(); //header-cursor(,1) (root)
+// BOOST_CHECK(!cur.parity());
+// BOOST_CHECK(searcher_t::iterator(cur) == my_tree.end());
+ BOOST_CHECK(*c1 = 8);
+
+ BOOST_CHECK(++c1 == my_tree.end());
+
+
+ --c1;
+ BOOST_CHECK(*c1 == 8);
+
+// BOOST_CHECK(searcher_t::cursor(my_tree.end()).parity() == 1);
 //
-// BOOST_CHECK(cur.end().parity() == 1);
-//
-// cur = searcher_t::cursor(c1);
-//
-// BOOST_CHECK(*cur == 8);
-//
-// BOOST_CHECK((++cur).empty());
-// BOOST_CHECK(!(--cur).parent().parity()); // root's parity...
+// BOOST_CHECK(cur.end().parity() == 1);
+//
+// cur = searcher_t::cursor(c1);
+//
+// BOOST_CHECK(*cur == 8);
+//
+// BOOST_CHECK((++cur).empty());
+// BOOST_CHECK(!(--cur).parent().parity()); // root's parity...
 //
-// BOOST_CHECK(*(searcher_t::cursor(c).begin()) == 8);
-
- BOOST_CHECK(*c1 == 8);
- BOOST_CHECK(++c1 == my_tree.end());
-
- // root (e.g. c) instead of c1 would crash this. but should that be really
- // illegal?
- c2 = my_tree.insert(c1, 18);
-
- BOOST_CHECK(*c2 == 18);
-
- ++c2;
- BOOST_CHECK(c2 == my_tree.end());
-
- c = my_tree.end();
- --c;
- BOOST_CHECK(*c == 18);
-
- c2 = my_tree.insert(c, 31);
-
- c2 = my_tree.insert(c, 412);
- c3 = my_tree.insert(c, 39);
-
- c4 = my_tree.insert(c, 7);
-
- BOOST_CHECK(*c4 == 7);
-
- BOOST_CHECK(++c2 == my_tree.end());
- c = my_tree.end();
- --c;
-
- BOOST_CHECK(*c != 39);
- BOOST_CHECK(*c == 412);
- --c;
- BOOST_CHECK(*c == 39);
-
- c = my_tree.begin();
-// BOOST_CHECK(searcher_t::cursor(c).parity() == 0);
-// BOOST_CHECK(*(searcher_t::cursor(c).parent()) != 412);
- BOOST_CHECK(*c < 413);
-
-// searcher_t::container_type& the_tree = my_tree.container();
-// searcher_t::cursor tree_cur = boost::tree::lower_bound(the_tree.root(),
-// 39, std::less<int>());
+// BOOST_CHECK(*(searcher_t::cursor(c).begin()) == 8);
+
+ BOOST_CHECK(*c1 == 8);
+ BOOST_CHECK(++c1 == my_tree.end());
+
+ // root (e.g. c) instead of c1 would crash this. but should that be really
+ // illegal?
+ c2 = my_tree.insert(c1, 18);
+
+ BOOST_CHECK(*c2 == 18);
+
+ ++c2;
+ BOOST_CHECK(c2 == my_tree.end());
+
+ c = my_tree.end();
+ --c;
+ BOOST_CHECK(*c == 18);
+
+ c2 = my_tree.insert(c, 31);
+
+ c2 = my_tree.insert(c, 412);
+ c3 = my_tree.insert(c, 39);
+
+ c4 = my_tree.insert(c, 7);
+
+ BOOST_CHECK(*c4 == 7);
+
+ BOOST_CHECK(++c2 == my_tree.end());
+ c = my_tree.end();
+ --c;
+
+ BOOST_CHECK(*c != 39);
+ BOOST_CHECK(*c == 412);
+ --c;
+ BOOST_CHECK(*c == 39);
+
+ c = my_tree.begin();
+// BOOST_CHECK(searcher_t::cursor(c).parity() == 0);
+// BOOST_CHECK(*(searcher_t::cursor(c).parent()) != 412);
+ BOOST_CHECK(*c < 413);
+
+// searcher_t::container_type& the_tree = my_tree.container();
+// searcher_t::cursor tree_cur = boost::tree::lower_bound(the_tree.root(),
+// 39, std::less<int>());
 //
-// BOOST_CHECK(tree_cur.empty());
-// BOOST_CHECK((++tree_cur).empty());
-// --tree_cur;
-// BOOST_CHECK(*tree_cur == 39);
-//
-// tree_cur = boost::tree::lower_bound(the_tree.root(), 18);
-// BOOST_CHECK(*tree_cur == 18);
-//
-// tree_cur = boost::tree::lower_bound(the_tree.root(), 30);
-// BOOST_CHECK(tree_cur.empty());
-// BOOST_CHECK(!(++tree_cur).empty());
-// --tree_cur;
-// BOOST_CHECK(*tree_cur == 31);
-//
-// tree_cur = boost::tree::lower_bound(the_tree.root(), 3);
-// BOOST_CHECK(*tree_cur == 7);
-
- c = my_tree.begin();
- BOOST_CHECK(*c++ == 7);
- BOOST_CHECK(*c++ == 8);
- BOOST_CHECK(*c++ == 18);
- BOOST_CHECK(*c++ == 31);
- BOOST_CHECK(*c++ == 39);
- BOOST_CHECK(*c++ == 412);
- BOOST_CHECK(c == my_tree.end());
- BOOST_CHECK(*--c == 412);
- BOOST_CHECK(*--c == 39);
- BOOST_CHECK(*--c == 31);
- BOOST_CHECK(*--c == 18);
- BOOST_CHECK(*--c == 8);
- BOOST_CHECK(*--c == 7);
- BOOST_CHECK(c == my_tree.begin());
-
- while (c != my_tree.end())
- ++c;
-
- ------c;
- BOOST_CHECK(*c == 31);
-
- //my_tree.erase(c);
-
- //BOOST_CHECK(*c == 39);
-
-// tree_cur = boost::tree::lower_bound(the_tree.root(), 412);
-// BOOST_CHECK(*tree_cur == 412);
-// BOOST_CHECK(*tree_cur.parent() == 18);
-//
-// c = my_tree.begin();
-// BOOST_CHECK(*c++ == 7);
-// BOOST_CHECK(*c++ == 8);
-// BOOST_CHECK(*c++ == 18);
-// BOOST_CHECK(*c++ == 39);
-// BOOST_CHECK(*c++ == 412);
-// BOOST_CHECK(c == my_tree.end());
-
+// BOOST_CHECK(tree_cur.empty());
+// BOOST_CHECK((++tree_cur).empty());
+// --tree_cur;
+// BOOST_CHECK(*tree_cur == 39);
+//
+// tree_cur = boost::tree::lower_bound(the_tree.root(), 18);
+// BOOST_CHECK(*tree_cur == 18);
+//
+// tree_cur = boost::tree::lower_bound(the_tree.root(), 30);
+// BOOST_CHECK(tree_cur.empty());
+// BOOST_CHECK(!(++tree_cur).empty());
+// --tree_cur;
+// BOOST_CHECK(*tree_cur == 31);
+//
+// tree_cur = boost::tree::lower_bound(the_tree.root(), 3);
+// BOOST_CHECK(*tree_cur == 7);
+
+ c = my_tree.begin();
+ BOOST_CHECK(*c++ == 7);
+ BOOST_CHECK(*c++ == 8);
+ BOOST_CHECK(*c++ == 18);
+ BOOST_CHECK(*c++ == 31);
+ BOOST_CHECK(*c++ == 39);
+ BOOST_CHECK(*c++ == 412);
+ BOOST_CHECK(c == my_tree.end());
+ BOOST_CHECK(*--c == 412);
+ BOOST_CHECK(*--c == 39);
+ BOOST_CHECK(*--c == 31);
+ BOOST_CHECK(*--c == 18);
+ BOOST_CHECK(*--c == 8);
+ BOOST_CHECK(*--c == 7);
+ BOOST_CHECK(c == my_tree.begin());
+
+ while (c != my_tree.end())
+ ++c;
+
+ ------c;
+ BOOST_CHECK(*c == 31);
+
+ //my_tree.erase(c);
+
+ //BOOST_CHECK(*c == 39);
+
+// tree_cur = boost::tree::lower_bound(the_tree.root(), 412);
+// BOOST_CHECK(*tree_cur == 412);
+// BOOST_CHECK(*tree_cur.parent() == 18);
+//
+// c = my_tree.begin();
+// BOOST_CHECK(*c++ == 7);
+// BOOST_CHECK(*c++ == 8);
+// BOOST_CHECK(*c++ == 18);
+// BOOST_CHECK(*c++ == 39);
+// BOOST_CHECK(*c++ == 412);
+// BOOST_CHECK(c == my_tree.end());
+
 
 }
 
@@ -175,7 +175,7 @@
 //init_unit_test_suite( int argc, char* argv[] )
 //{
 // boost::unit_test::test_suite* key_search_test =
-// BOOST_TEST_SUITE( "Key search binary vector test" );
+// BOOST_TEST_SUITE( "Key search binary vector test" );
 //
 // key_search_test->add( BOOST_TEST_CASE( &key_search_binary_tree_test ) );
 //
@@ -184,7 +184,7 @@
 
 int test_main(int, char* [])
 {
- test_key_search_binary_tree();
+ test_key_search_binary_tree();
 
- return 0;
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/multiway_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/multiway_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/multiway_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -12,17 +12,17 @@
 
 void test_multiway_tree()
 {
- using namespace boost::tree;
-
- typedef multiway_tree<int> tree_type;
- tree_type mytree;
+ using namespace boost::tree;
+
+ typedef multiway_tree<int> tree_type;
+ tree_type mytree;
 
- //tree_type::cursor c =
- //mytree.insert(mytree.root(), 3);
+ //tree_type::cursor c =
+ //mytree.insert(mytree.root(), 3);
 }
 
 int test_main(int, char* [])
 {
- test_multiway_tree();
- return 0;
+ test_multiway_tree();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/nary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/nary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/nary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -12,37 +12,37 @@
 
 void test_nary_tree()
 {
- using namespace boost::tree;
-
- typedef nary_tree<int> tree_type;
- tree_type mytree;
- tree_type::cursor c = mytree.root();
- BOOST_CHECK(mytree.root().empty());
- BOOST_CHECK(c.empty());
+ using namespace boost::tree;
+
+ typedef nary_tree<int> tree_type;
+ tree_type mytree;
+ tree_type::cursor c = mytree.root();
+ BOOST_CHECK(mytree.root().empty());
+ BOOST_CHECK(c.empty());
 
- c = mytree.insert(c, 4);
- BOOST_CHECK(*c == 4);
- BOOST_CHECK(c == mytree.root());
- BOOST_CHECK(c.empty());
-
- c = mytree.insert(c, 5);
- BOOST_CHECK(*c == 5);
- BOOST_CHECK(c == mytree.root());
- ++c;
- BOOST_CHECK(*c == 4);
- BOOST_CHECK(c != mytree.root());
- BOOST_CHECK(c.empty());
-// BOOST_CHECK(c.m_cur != tree_type::node_type::nil());
+ c = mytree.insert(c, 4);
+ BOOST_CHECK(*c == 4);
+ BOOST_CHECK(c == mytree.root());
+ BOOST_CHECK(c.empty());
+
+ c = mytree.insert(c, 5);
+ BOOST_CHECK(*c == 5);
+ BOOST_CHECK(c == mytree.root());
+ ++c;
+ BOOST_CHECK(*c == 4);
+ BOOST_CHECK(c != mytree.root());
+ BOOST_CHECK(c.empty());
+// BOOST_CHECK(c.m_cur != tree_type::node_type::nil());
 
- mytree.insert(c.end(), 3);
- BOOST_CHECK(*(c.begin()) == 3);
- BOOST_CHECK(!c.empty());
- BOOST_CHECK(c == c.begin().parent());
+ mytree.insert(c.end(), 3);
+ BOOST_CHECK(*(c.begin()) == 3);
+ BOOST_CHECK(!c.empty());
+ BOOST_CHECK(c == c.begin().parent());
 
 }
 
 int test_main(int, char* [])
 {
- test_nary_tree();
- return 0;
+ test_nary_tree();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/range_helpers_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/range_helpers_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/range_helpers_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -14,87 +14,87 @@
 
 void test_binary_lower_bound()
 {
- using boost::tree::binary_lower_bound;
-
- std::vector<int> vec(1, 9);
-
- std::vector<int>::const_iterator ci =
- binary_lower_bound(vec.begin(), vec.end(), 9, std::less<int>());
- BOOST_CHECK(ci == vec.begin());
-
- ci = binary_lower_bound(vec.begin(), vec.end(), 7, std::less<int>());
- BOOST_CHECK(ci == vec.begin());
-
- ci = binary_lower_bound(vec.begin(), vec.end(), 17, std::less<int>());
- BOOST_CHECK(ci == vec.end());
+ using boost::tree::binary_lower_bound;
+
+ std::vector<int> vec(1, 9);
+
+ std::vector<int>::const_iterator ci =
+ binary_lower_bound(vec.begin(), vec.end(), 9, std::less<int>());
+ BOOST_CHECK(ci == vec.begin());
+
+ ci = binary_lower_bound(vec.begin(), vec.end(), 7, std::less<int>());
+ BOOST_CHECK(ci == vec.begin());
+
+ ci = binary_lower_bound(vec.begin(), vec.end(), 17, std::less<int>());
+ BOOST_CHECK(ci == vec.end());
 }
 
 void test_binary_upper_bound()
 {
- using boost::tree::binary_upper_bound;
- std::vector<int> vec(1, 9);
-
- std::vector<int>::const_iterator ci =
- binary_upper_bound(vec.begin(), vec.end(), 7, std::less<int>());
- BOOST_CHECK(ci == vec.begin());
-
- ci = binary_upper_bound(vec.begin(), vec.end(), 9, std::less<int>());
- BOOST_CHECK(ci == vec.end());
-
- ci = binary_upper_bound(vec.begin(), vec.end(), 17, std::less<int>());
- BOOST_CHECK(ci == vec.end());
+ using boost::tree::binary_upper_bound;
+ std::vector<int> vec(1, 9);
+
+ std::vector<int>::const_iterator ci =
+ binary_upper_bound(vec.begin(), vec.end(), 7, std::less<int>());
+ BOOST_CHECK(ci == vec.begin());
+
+ ci = binary_upper_bound(vec.begin(), vec.end(), 9, std::less<int>());
+ BOOST_CHECK(ci == vec.end());
+
+ ci = binary_upper_bound(vec.begin(), vec.end(), 17, std::less<int>());
+ BOOST_CHECK(ci == vec.end());
 }
 
 static std::vector<int>&
 vec()
 {
- static std::vector<int> myvec(7);
- myvec[0] = -6;
- myvec[1] = -2;
- myvec[2] = -2;
- myvec[3] = 0;
- myvec[4] = 7;
- myvec[5] = 7;
- myvec[6] = 12;
- return myvec;
+ static std::vector<int> myvec(7);
+ myvec[0] = -6;
+ myvec[1] = -2;
+ myvec[2] = -2;
+ myvec[3] = 0;
+ myvec[4] = 7;
+ myvec[5] = 7;
+ myvec[6] = 12;
+ return myvec;
 }
 
 void test_linear_lower_bound()
 {
- using boost::tree::linear_lower_bound;
-
- std::vector<int>::const_iterator ci =
- linear_lower_bound(vec().begin(), vec().end(), 7, std::less<int>());
- BOOST_CHECK(ci == (vec().begin() + 4));
-
- ci = linear_lower_bound(vec().begin(), vec().end(), 9, std::less<int>());
- BOOST_CHECK(ci == (vec().begin() + 6));
-
- ci = linear_lower_bound(vec().begin(), vec().end(), 17, std::less<int>());
- BOOST_CHECK(ci == vec().end());
+ using boost::tree::linear_lower_bound;
+
+ std::vector<int>::const_iterator ci =
+ linear_lower_bound(vec().begin(), vec().end(), 7, std::less<int>());
+ BOOST_CHECK(ci == (vec().begin() + 4));
+
+ ci = linear_lower_bound(vec().begin(), vec().end(), 9, std::less<int>());
+ BOOST_CHECK(ci == (vec().begin() + 6));
+
+ ci = linear_lower_bound(vec().begin(), vec().end(), 17, std::less<int>());
+ BOOST_CHECK(ci == vec().end());
 }
 
 void test_linear_upper_bound()
 {
- using boost::tree::linear_upper_bound;
-
- std::vector<int>::const_iterator ci =
- linear_upper_bound(vec().begin(), vec().end(), 7, std::less<int>());
- BOOST_CHECK(ci == (vec().begin() + 6));
-
- ci = linear_upper_bound(vec().begin(), vec().end(), 9, std::less<int>());
- BOOST_CHECK(ci == (vec().begin() + 6));
-
- ci = linear_upper_bound(vec().begin(), vec().end(), 17, std::less<int>());
- BOOST_CHECK(ci == vec().end());
+ using boost::tree::linear_upper_bound;
+
+ std::vector<int>::const_iterator ci =
+ linear_upper_bound(vec().begin(), vec().end(), 7, std::less<int>());
+ BOOST_CHECK(ci == (vec().begin() + 6));
+
+ ci = linear_upper_bound(vec().begin(), vec().end(), 9, std::less<int>());
+ BOOST_CHECK(ci == (vec().begin() + 6));
+
+ ci = linear_upper_bound(vec().begin(), vec().end(), 17, std::less<int>());
+ BOOST_CHECK(ci == vec().end());
 }
 
 int test_main(int, char* [])
 {
- test_binary_lower_bound();
- test_binary_upper_bound();
-
- test_linear_lower_bound();
- test_linear_upper_bound();
- return 0;
+ test_binary_lower_bound();
+ test_binary_upper_bound();
+
+ test_linear_lower_bound();
+ test_linear_upper_bound();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/rank_search_binary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/rank_search_binary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/rank_search_binary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -21,27 +21,27 @@
 
 void test_rank_search_binary_tree()
 {
- using namespace boost::tree;
-//
-// typedef binary_tree<int, balancers::unbalanced, augmentors::rank<> > tree_t;
-// typedef searcher<false, tree_t> searcher_t;
-// searcher_t my_searcher;
-//
-// create_test_data_searcher(my_searcher);
-// tree_t& my_tree = my_searcher.container();
-//
-// tree_t::cursor c = select(my_tree, 3);
-// BOOST_CHECK(*c < 14);
-
-// typedef binary_tree<int, balancers::unbalanced, augmentors::rank<> > tree_t;
-// typedef test_searcher<false, tree_t> searcher_t;
-// searcher_t my_searcher;
-//
-// create_test_data_searcher(my_searcher);
-// tree_t& my_tree = my_searcher.container();
+ using namespace boost::tree;
+//
+// typedef binary_tree<int, balancers::unbalanced, augmentors::rank<> > tree_t;
+// typedef searcher<false, tree_t> searcher_t;
+// searcher_t my_searcher;
+//
+// create_test_data_searcher(my_searcher);
+// tree_t& my_tree = my_searcher.container();
+//
+// tree_t::cursor c = select(my_tree, 3);
+// BOOST_CHECK(*c < 14);
+
+// typedef binary_tree<int, balancers::unbalanced, augmentors::rank<> > tree_t;
+// typedef test_searcher<false, tree_t> searcher_t;
+// searcher_t my_searcher;
+//
+// create_test_data_searcher(my_searcher);
+// tree_t& my_tree = my_searcher.container();
 //
-// tree_t::cursor c = select_rank(my_tree, 3);
- //BOOST_CHECK(*c < 14);
+// tree_t::cursor c = select_rank(my_tree, 3);
+ //BOOST_CHECK(*c < 14);
 
 }
 
@@ -49,7 +49,7 @@
 //init_unit_test_suite( int argc, char* argv[] )
 //{
 // boost::unit_test::test_suite* rank_search_test =
-// BOOST_TEST_SUITE( "Key search binary vector test" );
+// BOOST_TEST_SUITE( "Key search binary vector test" );
 //
 // rank_search_test->add( BOOST_TEST_CASE( &rank_search_binary_tree_test ) );
 //
@@ -58,7 +58,7 @@
 
 int test_main(int, char* [])
 {
- test_rank_search_binary_tree();
+ test_rank_search_binary_tree();
 
- return 0;
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/red_black_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/red_black_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/red_black_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -23,133 +23,133 @@
 
 void test_red_black_tree()
 {
- using namespace boost::tree;
-
- typedef test_balancer<binary_tree<int>, balancers::red_black> red_black_tree_t;
-
- red_black_tree_t my_balancer;
- std::vector<int> my_vector;
-
- create_test_data_sequence(my_balancer);
- create_test_data_sequence(my_vector);
-
- BOOST_CHECK(std::equal(my_balancer.begin(), my_balancer.end(), my_vector.begin()));
-
-
-// typedef binary_tree<int, balancers::red_black> tree_t;
-// typedef searcher<false, tree_t> searcher_t;
-// searcher_t my_searcher;
-//
-// searcher_t::iterator it, c1, c2, c3, c4, c5;
-// searcher_t::const_iterator cit;
+ using namespace boost::tree;
+
+ typedef test_balancer<binary_tree<int>, balancers::red_black> red_black_tree_t;
+
+ red_black_tree_t my_balancer;
+ std::vector<int> my_vector;
+
+ create_test_data_sequence(my_balancer);
+ create_test_data_sequence(my_vector);
+
+ BOOST_CHECK(std::equal(my_balancer.begin(), my_balancer.end(), my_vector.begin()));
+
+
+// typedef binary_tree<int, balancers::red_black> tree_t;
+// typedef searcher<false, tree_t> searcher_t;
+// searcher_t my_searcher;
+//
+// searcher_t::iterator it, c1, c2, c3, c4, c5;
+// searcher_t::const_iterator cit;
 //
 
 //create_test_data_searcher(my_searcher);
 
-// it = my_searcher.end();
-//
- //c1 = my_searcher.insert(c, 8);
-// c1 = my_searcher.insert(it, 8);
-//
-
-// cit = my_searcher.begin();
-// BOOST_CHECK(*c1 == 8);
-
-// my_searcher.insert(5);
-// my_searcher.insert(it, 7);
-// my_searcher.insert(it, 12);
-// my_searcher.insert(it, 14);
-// my_searcher.insert(it, 2);
-// my_searcher.insert(it, 11);
-
-// searcher_t::container_type core = my_searcher.get_container();
-// searcher_t::container_type::cursor c = core.root().begin();
-// BOOST_CHECK(*c == 8);
-
-// BOOST_CHECK(c1.parent() == c); //Maybe factor out specifc tests (parent(), begin(), ...)
-// BOOST_CHECK(c1 == my_searcher.end().begin()); //FIXME. end means root
-// BOOST_CHECK(c1 != my_searcher.end().end()); //ditto
-// BOOST_CHECK(*c1 == 8);
-// BOOST_CHECK(!c1.has_child());
-//
-// BOOST_CHECK(c.has_child());
-// BOOST_CHECK(c == my_searcher.end());
-
-// ret = key_lower_bound(my_searcher.end(), 18,
-// lower_bound_wrapper<mycursor, int, std::less<int> >(),
-// boost::multi_index::identity<int>(), std::less<int>());
-
-// BOOST_CHECK(ret.first == my_searcher.root().end());
-// BOOST_CHECK(ret.second.first);
-// //BOOST_CHECK(ret.first.m_pos == 1);
-// c2 = my_searcher.insert(c, 18); //so where does that go?
-// //BOOST_CHECK(c2.parent() == c1);
-// //BOOST_CHECK(c1.end() == c2);
-// //BOOST_CHECK(c2 != my_searcher.root().end());
-//
-// BOOST_CHECK(*c2 == 18);
-// BOOST_CHECK(!c2.has_child());
+// it = my_searcher.end();
+//
+ //c1 = my_searcher.insert(c, 8);
+// c1 = my_searcher.insert(it, 8);
+//
+
+// cit = my_searcher.begin();
+// BOOST_CHECK(*c1 == 8);
+
+// my_searcher.insert(5);
+// my_searcher.insert(it, 7);
+// my_searcher.insert(it, 12);
+// my_searcher.insert(it, 14);
+// my_searcher.insert(it, 2);
+// my_searcher.insert(it, 11);
+
+// searcher_t::container_type core = my_searcher.get_container();
+// searcher_t::container_type::cursor c = core.root().begin();
+// BOOST_CHECK(*c == 8);
+
+// BOOST_CHECK(c1.parent() == c); //Maybe factor out specifc tests (parent(), begin(), ...)
+// BOOST_CHECK(c1 == my_searcher.end().begin()); //FIXME. end means root
+// BOOST_CHECK(c1 != my_searcher.end().end()); //ditto
+// BOOST_CHECK(*c1 == 8);
+// BOOST_CHECK(!c1.has_child());
+//
+// BOOST_CHECK(c.has_child());
+// BOOST_CHECK(c == my_searcher.end());
+
+// ret = key_lower_bound(my_searcher.end(), 18,
+// lower_bound_wrapper<mycursor, int, std::less<int> >(),
+// boost::multi_index::identity<int>(), std::less<int>());
+
+// BOOST_CHECK(ret.first == my_searcher.root().end());
+// BOOST_CHECK(ret.second.first);
+// //BOOST_CHECK(ret.first.m_pos == 1);
+// c2 = my_searcher.insert(c, 18); //so where does that go?
+// //BOOST_CHECK(c2.parent() == c1);
+// //BOOST_CHECK(c1.end() == c2);
+// //BOOST_CHECK(c2 != my_searcher.root().end());
+//
+// BOOST_CHECK(*c2 == 18);
+// BOOST_CHECK(!c2.has_child());
 //
-// BOOST_CHECK(c2 == my_searcher.root().end().begin());
-// //BOOST_CHECK(c2.m_parent == c.m_parent);
-// //BOOST_CHECK(c2 == c.m_parent);
-// //BOOST_CHECK(c1.has_child()); ///also fails!!!
-//
+// BOOST_CHECK(c2 == my_searcher.root().end().begin());
+// //BOOST_CHECK(c2.m_parent == c.m_parent);
+// //BOOST_CHECK(c2 == c.m_parent);
+// //BOOST_CHECK(c1.has_child()); ///also fails!!!
+//
 //
-//
-// c2 = my_searcher.insert(c, 31);
-//
-// c2 = my_searcher.insert(c, 412);
-// c3 = my_searcher.insert(c, 39);
-//
-// c4 = my_searcher.insert(c, 7);
-//
-// BOOST_CHECK(*(c2.parent()) == 31);
-// BOOST_CHECK(*(c2.begin()) == 39);
-//
-// //BOOST_CHECK(c4.parent() == c1);
+//
+// c2 = my_searcher.insert(c, 31);
+//
+// c2 = my_searcher.insert(c, 412);
+// c3 = my_searcher.insert(c, 39);
+//
+// c4 = my_searcher.insert(c, 7);
+//
+// BOOST_CHECK(*(c2.parent()) == 31);
+// BOOST_CHECK(*(c2.begin()) == 39);
+//
+// //BOOST_CHECK(c4.parent() == c1);
 //
-// BOOST_CHECK(*c3 == 39);
-// BOOST_CHECK(c4.parent() == c1);
-// BOOST_CHECK(c1.begin() == c4);
-
-
- //*(mytree.root()) = -5;
- //c = my_searcher.root();
- //my_searcher.c();
-// //*c = 5;
-//// //BOOST_CHECK(*c == 5);
-////
-// c1 = mytree.insert(c, 1);
-// BOOST_CHECK(*c == 1);
-// c2 = mytree.insert(c1, 2);
-// BOOST_CHECK(*c1 == 1);
-// BOOST_CHECK(*c2 == 2);
-
-
-// *c1 = 14; //how can we forbid this? by setting key to int const&
-// BOOST_CHECK(*c1 == 14);
-// BOOST_CHECK(*c2 == 2);
-// BOOST_CHECK(c2.parent() == c1);
-// BOOST_CHECK(c1.parent() == c);
-//
-// c3 = c1.end();
-// --c3;
-// BOOST_CHECK(*c3 == 2);
-// ++c3;
-// c4 = mytree.insert(c3, 4);
-// BOOST_CHECK(*c4 == 4);
-// c4 = c4.parent();
-// --c4;
-// BOOST_CHECK(*c4 == 2);
-//
-// //BOOST_CHECK(c4.parent() == c1);
-
+// BOOST_CHECK(*c3 == 39);
+// BOOST_CHECK(c4.parent() == c1);
+// BOOST_CHECK(c1.begin() == c4);
+
+
+ //*(mytree.root()) = -5;
+ //c = my_searcher.root();
+ //my_searcher.c();
+// //*c = 5;
+//// //BOOST_CHECK(*c == 5);
+////
+// c1 = mytree.insert(c, 1);
+// BOOST_CHECK(*c == 1);
+// c2 = mytree.insert(c1, 2);
+// BOOST_CHECK(*c1 == 1);
+// BOOST_CHECK(*c2 == 2);
+
+
+// *c1 = 14; //how can we forbid this? by setting key to int const&
+// BOOST_CHECK(*c1 == 14);
+// BOOST_CHECK(*c2 == 2);
+// BOOST_CHECK(c2.parent() == c1);
+// BOOST_CHECK(c1.parent() == c);
+//
+// c3 = c1.end();
+// --c3;
+// BOOST_CHECK(*c3 == 2);
+// ++c3;
+// c4 = mytree.insert(c3, 4);
+// BOOST_CHECK(*c4 == 4);
+// c4 = c4.parent();
+// --c4;
+// BOOST_CHECK(*c4 == 2);
+//
+// //BOOST_CHECK(c4.parent() == c1);
+
 }
 
 
 int test_main(int, char* [])
 {
- test_red_black_tree();
- return 0;
+ test_red_black_tree();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/rotate_binary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/rotate_binary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/rotate_binary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -19,70 +19,70 @@
 
 void test_rotate()
 {
- binary_tree<int> a;
- binary_tree<int> mytree(a);
+ binary_tree<int> a;
+ binary_tree<int> mytree(a);
 
- create_test_data_tree(mytree);
- binary_tree<int>::cursor c = mytree.root().begin().end();
- BOOST_CHECK(*c.begin() == 6);
-
- BOOST_CHECK(*c.parent() == 8);
- BOOST_CHECK(*c.parent().begin() == 3); // invariant candidate
-
- BOOST_CHECK(*--c == 3); // differently (not invariantly!) spoken
- BOOST_CHECK(*c.begin() == 1);
- BOOST_CHECK(*((++c).begin()).begin() == 4);
- BOOST_CHECK(*(++c.begin()).begin() == 7);
-
- BOOST_CHECK(c.parity() == 1);
- BOOST_CHECK(*c.begin() == 6);
-
- mytree.rotate(c); // Left rotate
-
- BOOST_CHECK(*c.begin() == 6);
- BOOST_CHECK(*c.parent().begin() == 8);
-
- BOOST_CHECK(*c.end().begin() == 7);
- BOOST_CHECK(*c.begin().begin() == 3);
- BOOST_CHECK(*c.begin().begin().begin() == 1);
-
- BOOST_CHECK(*c.begin().end().begin() == 4);
-
- c = c.begin();
- BOOST_CHECK(*c.begin() == 3);
-
- mytree.rotate(c); // Right rotate
-
- BOOST_CHECK(*c.begin() == 3);
- c = c.end();
-
- BOOST_CHECK(*c.begin() == 6);
-
- BOOST_CHECK(*c.parent() == 8);
- BOOST_CHECK(*c.parent().begin() == 3); // other invariant candidate
-
- BOOST_CHECK(*--c == 3);
- BOOST_CHECK(*c.begin() == 1);
- BOOST_CHECK(*((++c).begin()).begin() == 4);
- BOOST_CHECK(*(++c.begin()).begin() == 7);
-
- BOOST_CHECK(*c.begin() == 6);
-
-// BOOST_CHECK(*c.parent().parent().begin() == 6);
-// BOOST_CHECK(*c.parent().parent().end().begin() == 7);
-
-// BOOST_CHECK(*c.begin() == 1);
-// BOOST_CHECK(*c.parent().begin() == 3); // invariant?
-//
-// BOOST_CHECK(*c.parent().parent().begin() == 6);
-// BOOST_CHECK(*c.parent().parent().parent().begin() == 8);
-// BOOST_CHECK(*c.parent().parent().end().begin() == 7);
-
+ create_test_data_tree(mytree);
+ binary_tree<int>::cursor c = mytree.root().begin().end();
+ BOOST_CHECK(*c.begin() == 6);
+
+ BOOST_CHECK(*c.parent() == 8);
+ BOOST_CHECK(*c.parent().begin() == 3); // invariant candidate
+
+ BOOST_CHECK(*--c == 3); // differently (not invariantly!) spoken
+ BOOST_CHECK(*c.begin() == 1);
+ BOOST_CHECK(*((++c).begin()).begin() == 4);
+ BOOST_CHECK(*(++c.begin()).begin() == 7);
+
+ BOOST_CHECK(c.parity() == 1);
+ BOOST_CHECK(*c.begin() == 6);
+
+ mytree.rotate(c); // Left rotate
+
+ BOOST_CHECK(*c.begin() == 6);
+ BOOST_CHECK(*c.parent().begin() == 8);
+
+ BOOST_CHECK(*c.end().begin() == 7);
+ BOOST_CHECK(*c.begin().begin() == 3);
+ BOOST_CHECK(*c.begin().begin().begin() == 1);
+
+ BOOST_CHECK(*c.begin().end().begin() == 4);
+
+ c = c.begin();
+ BOOST_CHECK(*c.begin() == 3);
+
+ mytree.rotate(c); // Right rotate
+
+ BOOST_CHECK(*c.begin() == 3);
+ c = c.end();
+
+ BOOST_CHECK(*c.begin() == 6);
+
+ BOOST_CHECK(*c.parent() == 8);
+ BOOST_CHECK(*c.parent().begin() == 3); // other invariant candidate
+
+ BOOST_CHECK(*--c == 3);
+ BOOST_CHECK(*c.begin() == 1);
+ BOOST_CHECK(*((++c).begin()).begin() == 4);
+ BOOST_CHECK(*(++c.begin()).begin() == 7);
+
+ BOOST_CHECK(*c.begin() == 6);
+
+// BOOST_CHECK(*c.parent().parent().begin() == 6);
+// BOOST_CHECK(*c.parent().parent().end().begin() == 7);
+
+// BOOST_CHECK(*c.begin() == 1);
+// BOOST_CHECK(*c.parent().begin() == 3); // invariant?
+//
+// BOOST_CHECK(*c.parent().parent().begin() == 6);
+// BOOST_CHECK(*c.parent().parent().parent().begin() == 8);
+// BOOST_CHECK(*c.parent().parent().end().begin() == 7);
+
 }
 
 
 int test_main(int, char* [])
 {
- test_rotate();
- return 0;
+ test_rotate();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/search_ordered_vector_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/search_ordered_vector_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/search_ordered_vector_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -15,34 +15,34 @@
 
 static void search_ordered_vector_test()
 {
-// using boost::tree::searcher;
-// using std::vector;
-//
-// typedef searcher<false, vector<int> > searcher_t;
-// searcher_t my_searcher;
+// using boost::tree::searcher;
+// using std::vector;
+//
+// typedef searcher<false, vector<int> > searcher_t;
+// searcher_t my_searcher;
 //
-// searcher_t::cursor c, c1, c2, c3, c4, c5;
-//
-// c = my_searcher.end();
+// searcher_t::cursor c, c1, c2, c3, c4, c5;
+//
+// c = my_searcher.end();
 //
-// c1 = my_searcher.insert(c, 18);
-// c1 = my_searcher.insert(c1, 7); //FIXME: crash if pos hint == c
-// c1 = my_searcher.insert(c1, 6);
-// c1 = my_searcher.insert(c1, 8);
+// c1 = my_searcher.insert(c, 18);
+// c1 = my_searcher.insert(c1, 7); //FIXME: crash if pos hint == c
+// c1 = my_searcher.insert(c1, 6);
+// c1 = my_searcher.insert(c1, 8);
 //
-// c1 = my_searcher.begin();
-// BOOST_CHECK(*c1++ == 6);
-// BOOST_CHECK(*c1++ == 7);
-// BOOST_CHECK(*c1++ == 8);
-// BOOST_CHECK(*c1++ == 18);
-// BOOST_CHECK(c1 == my_searcher.end());
+// c1 = my_searcher.begin();
+// BOOST_CHECK(*c1++ == 6);
+// BOOST_CHECK(*c1++ == 7);
+// BOOST_CHECK(*c1++ == 8);
+// BOOST_CHECK(*c1++ == 18);
+// BOOST_CHECK(c1 == my_searcher.end());
 }
 
 //boost::unit_test::test_suite*
 //init_unit_test_suite( int argc, char* argv[] )
 //{
 // boost::unit_test::test_suite* ordered_vector_test =
-// BOOST_TEST_SUITE( "Ordered vector test" );
+// BOOST_TEST_SUITE( "Ordered vector test" );
 //
 // ordered_vector_test->add( BOOST_TEST_CASE( &search_ordered_vector_test ) );
 //
@@ -52,6 +52,6 @@
 
 int test_main(int, char* [])
 {
- search_ordered_vector_test();
- return 0;
+ search_ordered_vector_test();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/string_search_binary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/string_search_binary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/string_search_binary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -27,59 +27,59 @@
 // TODO: get timings. that makes that no testcase anymore, right?
 void test_normal_string_search_binary_tree()
 {
- using namespace boost::tree;
-
- typedef searcher<false, balanced_tree<binary_tree<std::string>, balancers::unbalanced > > searcher_t;
- searcher_t my_tree;
-
- my_tree.insert("anthology");
- my_tree.insert("anagram");
- my_tree.insert("anodyne");
- my_tree.insert("anthrax");
- my_tree.insert("anteater");
-
- //FIXME: const_iterator doesn't work properly yet
- searcher_t::iterator ci = my_tree.begin();
- BOOST_CHECK(*ci++ == "anagram");
- BOOST_CHECK(*ci++ == "anodyne");
- BOOST_CHECK(*ci++ == "anteater");
- BOOST_CHECK(*ci++ == "anthology");
- BOOST_CHECK(*ci++ == "anthrax");
- BOOST_CHECK(ci == my_tree.end());
+ using namespace boost::tree;
+
+ typedef searcher<false, balanced_tree<binary_tree<std::string>, balancers::unbalanced > > searcher_t;
+ searcher_t my_tree;
+
+ my_tree.insert("anthology");
+ my_tree.insert("anagram");
+ my_tree.insert("anodyne");
+ my_tree.insert("anthrax");
+ my_tree.insert("anteater");
+
+ //FIXME: const_iterator doesn't work properly yet
+ searcher_t::iterator ci = my_tree.begin();
+ BOOST_CHECK(*ci++ == "anagram");
+ BOOST_CHECK(*ci++ == "anodyne");
+ BOOST_CHECK(*ci++ == "anteater");
+ BOOST_CHECK(*ci++ == "anthology");
+ BOOST_CHECK(*ci++ == "anthrax");
+ BOOST_CHECK(ci == my_tree.end());
 }
 
 void test_optimized_string_search_binary_tree()
 {
-
- using namespace boost::tree;
- using boost::multi_index::identity;
+
+ using namespace boost::tree;
+ using boost::multi_index::identity;
 
- typedef searcher<false, balanced_tree<binary_tree<std::string>, balancers::unbalanced>,
- identity<std::string>,
- container_lexicographical_compare<std::string, std::string>
- > searcher_t;
- searcher_t my_tree;
-
- my_tree.insert("anthology");
- my_tree.insert("anagram");
- my_tree.insert("anodyne");
- my_tree.insert("anthrax");
- my_tree.insert("anteater");
-
- //FIXME: const_iterator doesn't work properly yet
- searcher_t::iterator ci = my_tree.begin();
- BOOST_CHECK(*ci++ == "anagram");
- BOOST_CHECK(*ci++ == "anodyne");
- BOOST_CHECK(*ci++ == "anteater");
- BOOST_CHECK(*ci++ == "anthology");
- BOOST_CHECK(*ci++ == "anthrax");
- BOOST_CHECK(ci == my_tree.end());
+ typedef searcher<false, balanced_tree<binary_tree<std::string>, balancers::unbalanced>,
+ identity<std::string>,
+ container_lexicographical_compare<std::string, std::string>
+ > searcher_t;
+ searcher_t my_tree;
+
+ my_tree.insert("anthology");
+ my_tree.insert("anagram");
+ my_tree.insert("anodyne");
+ my_tree.insert("anthrax");
+ my_tree.insert("anteater");
+
+ //FIXME: const_iterator doesn't work properly yet
+ searcher_t::iterator ci = my_tree.begin();
+ BOOST_CHECK(*ci++ == "anagram");
+ BOOST_CHECK(*ci++ == "anodyne");
+ BOOST_CHECK(*ci++ == "anteater");
+ BOOST_CHECK(*ci++ == "anthology");
+ BOOST_CHECK(*ci++ == "anthrax");
+ BOOST_CHECK(ci == my_tree.end());
 }
 
 
 int test_main(int, char* [])
 {
- test_normal_string_search_binary_tree();
- test_optimized_string_search_binary_tree();
- return 0;
+ test_normal_string_search_binary_tree();
+ test_optimized_string_search_binary_tree();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_checks.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_checks.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_checks.hpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -24,79 +24,79 @@
 template <class Cursor, class Container>
 void test_for_each(Cursor c, Container& cont)
 {
- boost::tree::ORDER::for_each(
- c,
- boost::lambda::bind(&Container::push_back, &cont, boost::lambda::_1)
- );
- test::ORDER::traversal(cont.begin(), cont.end());
+ boost::tree::ORDER::for_each(
+ c,
+ boost::lambda::bind(&Container::push_back, &cont, boost::lambda::_1)
+ );
+ test::ORDER::traversal(cont.begin(), cont.end());
 }
 
 template <class Cursor, class OutCursor, class Container>
 void test_copy(Cursor c, OutCursor& o, Container& cont)
-{
- boost::tree::ORDER::copy(c, o);
- test::ORDER::traversal(cont.begin(), cont.end());
+{
+ boost::tree::ORDER::copy(c, o);
+ test::ORDER::traversal(cont.begin(), cont.end());
 }
 
 template <class Cursor, class OutCursor, class Container>
 void test_transform(Cursor c, Cursor d, OutCursor& o, Container& cont)
 {
- // First copy test_tree to test_tree2, by adding 1 to each element,
- // then copy test_tree2 to test_list, by subtracting 1 - so
- // test_list should hold test_tree's original elements in ORDER.
- boost::tree::ORDER::transform(c, d, std::bind2nd(std::plus<int>(),1));
- boost::tree::ORDER::transform(d, o, std::bind2nd(std::minus<int>(),1));
- test::ORDER::traversal(cont.begin(), cont.end());
+ // First copy test_tree to test_tree2, by adding 1 to each element,
+ // then copy test_tree2 to test_list, by subtracting 1 - so
+ // test_list should hold test_tree's original elements in ORDER.
+ boost::tree::ORDER::transform(c, d, std::bind2nd(std::plus<int>(),1));
+ boost::tree::ORDER::transform(d, o, std::bind2nd(std::minus<int>(),1));
+ test::ORDER::traversal(cont.begin(), cont.end());
 }
 
 template <class Cursor>
 void algorithms(Cursor c, Cursor d)
 {
- std::list<int> test_list;
- typedef std::back_insert_iterator< std::list<int> > back_insert_iter_list_int;
- typedef output_cursor_iterator_wrapper<back_insert_iter_list_int> oc_bi_lst_type;
- back_insert_iter_list_int it_test_list = std::back_inserter(test_list);
- oc_bi_lst_type oc_test_list = oc_bi_lst_type(it_test_list);
-
- test_for_each(c, test_list);
-
- test_list.clear();
- test_copy(c, oc_test_list, test_list);
-
- test_list.clear();
- test_transform(c, d, oc_test_list, test_list);
+ std::list<int> test_list;
+ typedef std::back_insert_iterator< std::list<int> > back_insert_iter_list_int;
+ typedef output_cursor_iterator_wrapper<back_insert_iter_list_int> oc_bi_lst_type;
+ back_insert_iter_list_int it_test_list = std::back_inserter(test_list);
+ oc_bi_lst_type oc_test_list = oc_bi_lst_type(it_test_list);
+
+ test_for_each(c, test_list);
+
+ test_list.clear();
+ test_copy(c, oc_test_list, test_list);
+
+ test_list.clear();
+ test_transform(c, d, oc_test_list, test_list);
 }
 
 template <class Cursor>
-void compare_cursor_to_iterator_traversal(Cursor cur) {
- std::list<int> test_list;
- typedef std::back_insert_iterator< std::list<int> > back_insert_iter_list_int;
- typedef output_cursor_iterator_wrapper<back_insert_iter_list_int> oc_bi_lst_type;
- back_insert_iter_list_int it_test_list = std::back_inserter(test_list);
- oc_bi_lst_type oc_test_list = oc_bi_lst_type(it_test_list);
-
- boost::tree::ORDER::copy(cur, oc_test_list);
-
- // Are the elements accessed in the correct order?
- BOOST_CHECK(std::equal( boost::tree::ORDER::begin(cur),
- boost::tree::ORDER::end(cur),
- test_list.begin()
- ));
-
- // Does end() mark the right element?
- BOOST_CHECK(std::distance(boost::tree::ORDER::begin(cur),
- boost::tree::ORDER::end(cur)) ==
- std::distance(test_list.begin(), test_list.end()));
-
- // Reverse order.
- BOOST_CHECK(std::equal( boost::tree::ORDER::rbegin(cur),
- boost::tree::ORDER::rend(cur),
- test_list.rbegin()
- ));
-
- BOOST_CHECK(std::distance(boost::tree::ORDER::rbegin(cur),
- boost::tree::ORDER::rend(cur)) ==
- std::distance(test_list.rbegin(), test_list.rend()));
+void compare_cursor_to_iterator_traversal(Cursor cur) {
+ std::list<int> test_list;
+ typedef std::back_insert_iterator< std::list<int> > back_insert_iter_list_int;
+ typedef output_cursor_iterator_wrapper<back_insert_iter_list_int> oc_bi_lst_type;
+ back_insert_iter_list_int it_test_list = std::back_inserter(test_list);
+ oc_bi_lst_type oc_test_list = oc_bi_lst_type(it_test_list);
+
+ boost::tree::ORDER::copy(cur, oc_test_list);
+
+ // Are the elements accessed in the correct order?
+ BOOST_CHECK(std::equal( boost::tree::ORDER::begin(cur),
+ boost::tree::ORDER::end(cur),
+ test_list.begin()
+ ));
+
+ // Does end() mark the right element?
+ BOOST_CHECK(std::distance(boost::tree::ORDER::begin(cur),
+ boost::tree::ORDER::end(cur)) ==
+ std::distance(test_list.begin(), test_list.end()));
+
+ // Reverse order.
+ BOOST_CHECK(std::equal( boost::tree::ORDER::rbegin(cur),
+ boost::tree::ORDER::rend(cur),
+ test_list.rbegin()
+ ));
+
+ BOOST_CHECK(std::distance(boost::tree::ORDER::rbegin(cur),
+ boost::tree::ORDER::rend(cur)) ==
+ std::distance(test_list.rbegin(), test_list.rend()));
 
 }
 

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -16,64 +16,64 @@
 template <class Tree>
 void create_test_data_tree(Tree& ret)
 {
- // For augmented trees. (Why is this necessary? Nothing here is explicit!)
- typedef typename Tree::value_type value_type;
-
- typename Tree::cursor cur = ret.insert(ret.root(), value_type(8));
- cur = ret.insert(cur, value_type(3));
- ret.insert(cur, value_type(1));
- cur = ret.insert(++cur, value_type(6));
- ret.insert(cur, value_type(4));
- ret.insert(++cur, value_type(7));
- cur = ret.insert(ret.root().end(), value_type(10));
- cur = ret.insert(ret.root().end().end(), value_type(14));
- cur = ret.insert(cur, value_type(13));
- cur = ret.insert(cur, value_type(11));
- cur = ret.insert(++cur, value_type(12));
+ // For augmented trees. (Why is this necessary? Nothing here is explicit!)
+ typedef typename Tree::value_type value_type;
+
+ typename Tree::cursor cur = ret.insert(ret.root(), value_type(8));
+ cur = ret.insert(cur, value_type(3));
+ ret.insert(cur, value_type(1));
+ cur = ret.insert(++cur, value_type(6));
+ ret.insert(cur, value_type(4));
+ ret.insert(++cur, value_type(7));
+ cur = ret.insert(ret.root().end(), value_type(10));
+ cur = ret.insert(ret.root().end().end(), value_type(14));
+ cur = ret.insert(cur, value_type(13));
+ cur = ret.insert(cur, value_type(11));
+ cur = ret.insert(++cur, value_type(12));
 }
 
 template <class Tree>
 void validate_test_data_tree(Tree const& ret)
 {
- BOOST_CHECK(*ret.root().begin() == 8);
- BOOST_CHECK(*ret.root().begin().begin() == 3);
- BOOST_CHECK(*ret.root().begin().begin().begin() == 1); //Leaf
- BOOST_CHECK(*ret.root().begin().end().begin() == 6);
- BOOST_CHECK(*ret.root().begin().end().begin().begin() == 4); //Leaf
- BOOST_CHECK(*ret.root().begin().end().end().begin() == 7); //Leaf
-
- BOOST_CHECK(*ret.root().end().begin() == 10);
- BOOST_CHECK(*ret.root().end().end().begin() == 14);
- BOOST_CHECK(*ret.root().end().end().begin().begin() == 13);
- BOOST_CHECK(*ret.root().end().end().begin().begin().begin() == 11);
- BOOST_CHECK(*ret.root().end().end().begin().begin().end().begin() == 12); //Leaf
+ BOOST_CHECK(*ret.root().begin() == 8);
+ BOOST_CHECK(*ret.root().begin().begin() == 3);
+ BOOST_CHECK(*ret.root().begin().begin().begin() == 1); //Leaf
+ BOOST_CHECK(*ret.root().begin().end().begin() == 6);
+ BOOST_CHECK(*ret.root().begin().end().begin().begin() == 4); //Leaf
+ BOOST_CHECK(*ret.root().begin().end().end().begin() == 7); //Leaf
+
+ BOOST_CHECK(*ret.root().end().begin() == 10);
+ BOOST_CHECK(*ret.root().end().end().begin() == 14);
+ BOOST_CHECK(*ret.root().end().end().begin().begin() == 13);
+ BOOST_CHECK(*ret.root().end().end().begin().begin().begin() == 11);
+ BOOST_CHECK(*ret.root().end().end().begin().begin().end().begin() == 12); //Leaf
 }
 
 template <class Tree>
 void validate_corresponding_forest_tree(Tree const& t)
 {
- typename Tree::const_cursor c = t.root().begin();
- BOOST_CHECK(*c == 8);
- BOOST_CHECK(*c.to_begin() == 3);
- BOOST_CHECK(*c.to_begin() == 1);
- BOOST_CHECK(c.empty());
- BOOST_CHECK(++c == t.root().begin().begin().end());
- --c;
- c.to_parent();
- BOOST_CHECK(*++c == 6);
- BOOST_CHECK(*c.to_begin() == 4);
- c.to_parent();
- BOOST_CHECK(*++c == 7);
- BOOST_CHECK(++c == t.root().begin().end());
-
- c = t.root().begin();
- BOOST_CHECK(*++c == 10);
- BOOST_CHECK(*++c == 14);
- BOOST_CHECK(++c == t.root().end());
- --c;
- BOOST_CHECK(*c.to_begin() == 13);
- BOOST_CHECK(*c.to_begin() == 11);
- BOOST_CHECK(*++c == 12);
+ typename Tree::const_cursor c = t.root().begin();
+ BOOST_CHECK(*c == 8);
+ BOOST_CHECK(*c.to_begin() == 3);
+ BOOST_CHECK(*c.to_begin() == 1);
+ BOOST_CHECK(c.empty());
+ BOOST_CHECK(++c == t.root().begin().begin().end());
+ --c;
+ c.to_parent();
+ BOOST_CHECK(*++c == 6);
+ BOOST_CHECK(*c.to_begin() == 4);
+ c.to_parent();
+ BOOST_CHECK(*++c == 7);
+ BOOST_CHECK(++c == t.root().begin().end());
+
+ c = t.root().begin();
+ BOOST_CHECK(*++c == 10);
+ BOOST_CHECK(*++c == 14);
+ BOOST_CHECK(++c == t.root().end());
+ --c;
+ BOOST_CHECK(*c.to_begin() == 13);
+ BOOST_CHECK(*c.to_begin() == 11);
+ BOOST_CHECK(*++c == 12);
 }
 
 namespace test {
@@ -83,46 +83,46 @@
 template <class Iterator>
 void traversal(Iterator a, Iterator b)
 {
- BOOST_CHECK(*a++ == 8);
- BOOST_CHECK(*a++ == 3);
- BOOST_CHECK(*a++ == 1);
- BOOST_CHECK(*a++ == 6);
- BOOST_CHECK(*a++ == 4);
- BOOST_CHECK(*a++ == 7);
- BOOST_CHECK(*a++ == 10);
- BOOST_CHECK(*a++ == 14);
- BOOST_CHECK(*a++ == 13);
- BOOST_CHECK(*a++ == 11);
- BOOST_CHECK(*a++ == 12);
- BOOST_CHECK(a == b);
+ BOOST_CHECK(*a++ == 8);
+ BOOST_CHECK(*a++ == 3);
+ BOOST_CHECK(*a++ == 1);
+ BOOST_CHECK(*a++ == 6);
+ BOOST_CHECK(*a++ == 4);
+ BOOST_CHECK(*a++ == 7);
+ BOOST_CHECK(*a++ == 10);
+ BOOST_CHECK(*a++ == 14);
+ BOOST_CHECK(*a++ == 13);
+ BOOST_CHECK(*a++ == 11);
+ BOOST_CHECK(*a++ == 12);
+ BOOST_CHECK(a == b);
 }
 
 template <class Iterator>
 void reverse_traversal(Iterator a, Iterator b)
-{
- BOOST_CHECK(*--a == 12);
- BOOST_CHECK(*--a == 11);
- BOOST_CHECK(*--a == 13);
- BOOST_CHECK(*--a == 14);
- BOOST_CHECK(*--a == 10);
- BOOST_CHECK(*--a == 7);
- BOOST_CHECK(*--a == 4);
- BOOST_CHECK(*--a == 6);
- BOOST_CHECK(*--a == 1);
- BOOST_CHECK(*--a == 3);
- BOOST_CHECK(*--a == 8);
- BOOST_CHECK(a == b);
+{
+ BOOST_CHECK(*--a == 12);
+ BOOST_CHECK(*--a == 11);
+ BOOST_CHECK(*--a == 13);
+ BOOST_CHECK(*--a == 14);
+ BOOST_CHECK(*--a == 10);
+ BOOST_CHECK(*--a == 7);
+ BOOST_CHECK(*--a == 4);
+ BOOST_CHECK(*--a == 6);
+ BOOST_CHECK(*--a == 1);
+ BOOST_CHECK(*--a == 3);
+ BOOST_CHECK(*--a == 8);
+ BOOST_CHECK(a == b);
 }
 
 template <class Iterator>
 void subtree_traversal(Iterator a, Iterator b)
 {
- BOOST_CHECK(*a++ == 3);
- BOOST_CHECK(*a++ == 1);
- BOOST_CHECK(*a++ == 6);
- BOOST_CHECK(*a++ == 4);
- BOOST_CHECK(*a++ == 7);
- BOOST_CHECK(a == b);
+ BOOST_CHECK(*a++ == 3);
+ BOOST_CHECK(*a++ == 1);
+ BOOST_CHECK(*a++ == 6);
+ BOOST_CHECK(*a++ == 4);
+ BOOST_CHECK(*a++ == 7);
+ BOOST_CHECK(a == b);
 }
 
 } // namespace preorder
@@ -131,36 +131,36 @@
 
 template <class Iterator>
 void traversal(Iterator a, Iterator b)
-{
- BOOST_CHECK(*a++ == 1);
- BOOST_CHECK(*a++ == 3);
- BOOST_CHECK(*a++ == 4);
- BOOST_CHECK(*a++ == 6);
- BOOST_CHECK(*a++ == 7);
- BOOST_CHECK(*a++ == 8);
- BOOST_CHECK(*a++ == 10);
- BOOST_CHECK(*a++ == 11);
- BOOST_CHECK(*a++ == 12);
- BOOST_CHECK(*a++ == 13);
- BOOST_CHECK(*a++ == 14);
- BOOST_CHECK(a == b);
+{
+ BOOST_CHECK(*a++ == 1);
+ BOOST_CHECK(*a++ == 3);
+ BOOST_CHECK(*a++ == 4);
+ BOOST_CHECK(*a++ == 6);
+ BOOST_CHECK(*a++ == 7);
+ BOOST_CHECK(*a++ == 8);
+ BOOST_CHECK(*a++ == 10);
+ BOOST_CHECK(*a++ == 11);
+ BOOST_CHECK(*a++ == 12);
+ BOOST_CHECK(*a++ == 13);
+ BOOST_CHECK(*a++ == 14);
+ BOOST_CHECK(a == b);
 }
 
 template <class Iterator>
 void reverse_traversal(Iterator a, Iterator b)
-{
- BOOST_CHECK(*--a == 14);
- BOOST_CHECK(*--a == 13);
- BOOST_CHECK(*--a == 12);
- BOOST_CHECK(*--a == 11);
- BOOST_CHECK(*--a == 10);
- BOOST_CHECK(*--a == 8);
- BOOST_CHECK(*--a == 7);
- BOOST_CHECK(*--a == 6);
- BOOST_CHECK(*--a == 4);
- BOOST_CHECK(*--a == 3);
- BOOST_CHECK(*--a == 1);
- BOOST_CHECK(a == b);
+{
+ BOOST_CHECK(*--a == 14);
+ BOOST_CHECK(*--a == 13);
+ BOOST_CHECK(*--a == 12);
+ BOOST_CHECK(*--a == 11);
+ BOOST_CHECK(*--a == 10);
+ BOOST_CHECK(*--a == 8);
+ BOOST_CHECK(*--a == 7);
+ BOOST_CHECK(*--a == 6);
+ BOOST_CHECK(*--a == 4);
+ BOOST_CHECK(*--a == 3);
+ BOOST_CHECK(*--a == 1);
+ BOOST_CHECK(a == b);
 }
 
 } // namespace inorder
@@ -169,36 +169,36 @@
 
 template <class Iterator>
 void traversal(Iterator a, Iterator b)
-{
- BOOST_CHECK(*a++ == 1);
- BOOST_CHECK(*a++ == 4);
- BOOST_CHECK(*a++ == 7);
- BOOST_CHECK(*a++ == 6);
- BOOST_CHECK(*a++ == 3);
- BOOST_CHECK(*a++ == 12);
- BOOST_CHECK(*a++ == 11);
- BOOST_CHECK(*a++ == 13);
- BOOST_CHECK(*a++ == 14);
- BOOST_CHECK(*a++ == 10);
- BOOST_CHECK(*a++ == 8);
- BOOST_CHECK(a == b);
+{
+ BOOST_CHECK(*a++ == 1);
+ BOOST_CHECK(*a++ == 4);
+ BOOST_CHECK(*a++ == 7);
+ BOOST_CHECK(*a++ == 6);
+ BOOST_CHECK(*a++ == 3);
+ BOOST_CHECK(*a++ == 12);
+ BOOST_CHECK(*a++ == 11);
+ BOOST_CHECK(*a++ == 13);
+ BOOST_CHECK(*a++ == 14);
+ BOOST_CHECK(*a++ == 10);
+ BOOST_CHECK(*a++ == 8);
+ BOOST_CHECK(a == b);
 }
 
 template <class Iterator>
 void reverse_traversal(Iterator a, Iterator b)
-{
- BOOST_CHECK(*--a == 8);
- BOOST_CHECK(*--a == 10);
- BOOST_CHECK(*--a == 14);
- BOOST_CHECK(*--a == 13);
- BOOST_CHECK(*--a == 11);
- BOOST_CHECK(*--a == 12);
- BOOST_CHECK(*--a == 3);
- BOOST_CHECK(*--a == 6);
- BOOST_CHECK(*--a == 7);
- BOOST_CHECK(*--a == 4);
- BOOST_CHECK(*--a == 1);
- BOOST_CHECK(a == b);
+{
+ BOOST_CHECK(*--a == 8);
+ BOOST_CHECK(*--a == 10);
+ BOOST_CHECK(*--a == 14);
+ BOOST_CHECK(*--a == 13);
+ BOOST_CHECK(*--a == 11);
+ BOOST_CHECK(*--a == 12);
+ BOOST_CHECK(*--a == 3);
+ BOOST_CHECK(*--a == 6);
+ BOOST_CHECK(*--a == 7);
+ BOOST_CHECK(*--a == 4);
+ BOOST_CHECK(*--a == 1);
+ BOOST_CHECK(a == b);
 }
 
 } // namespace postorder
@@ -207,12 +207,12 @@
 
 template <class Iterator>
 void traversal_from_leaf4(Iterator a, Iterator b)
-{
- BOOST_CHECK(*a == 4);
- BOOST_CHECK(*++a == 6);
- BOOST_CHECK(*++a == 3);
- BOOST_CHECK(*++a == 8);
- BOOST_CHECK(++a == b);
+{
+ BOOST_CHECK(*a == 4);
+ BOOST_CHECK(*++a == 6);
+ BOOST_CHECK(*++a == 3);
+ BOOST_CHECK(*++a == 8);
+ BOOST_CHECK(++a == b);
 }
 
 } // namespace ascending

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/treap_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/treap_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/treap_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -21,45 +21,45 @@
 
 void test_treap()
 {
- using namespace boost::tree;
-
- std::vector<int> my_vector;
- typedef binary_tree<int> tree_t;
- //typedef test_searcher<false, tree_t> searcher_t;
- typedef test_balancer<binary_tree<int>, balancers::treap> treap_t;
-
- //searcher_t my_searcher;
- treap_t my_balancer;
- //tree_t my_tree;
-
- //create_test_data_searcher(my_searcher);
- create_test_data_sequence(my_balancer);
- create_test_data_sequence(my_vector);
+ using namespace boost::tree;
+
+ std::vector<int> my_vector;
+ typedef binary_tree<int> tree_t;
+ //typedef test_searcher<false, tree_t> searcher_t;
+ typedef test_balancer<binary_tree<int>, balancers::treap> treap_t;
+
+ //searcher_t my_searcher;
+ treap_t my_balancer;
+ //tree_t my_tree;
+
+ //create_test_data_searcher(my_searcher);
+ create_test_data_sequence(my_balancer);
+ create_test_data_sequence(my_vector);
 
-// Segfaults:
-// BOOST_CHECK(std::equal(my_balancer.begin(), my_balancer.end(), my_vector.begin()));
+// Segfaults:
+// BOOST_CHECK(std::equal(my_balancer.begin(), my_balancer.end(), my_vector.begin()));
 
- //TODO: More tests?
- for (treap_t::iterator ci = my_balancer.begin(); ci != my_balancer.end(); ++ci) {
- treap_t::hierarchy_type::cursor c = ci.base().base();
-// int priority = c->metadata().get_priority(); // FIXME: Segfaults!
-// if (!c.empty()) {
-// BOOST_CHECK(priority
-// > c.begin()->metadata().get_priority());
-// }
- }
-
- //treap_t::iterator ci = my_balancer.begin();
- //treap_t::hierarchy_type::cursor c;
- //c = ci.base().base();
- //c = c.parent();
- //treap_t::metadata_type m = c->metadata();
- //int i = ci.base().base().parent()->metadata().get_priority();//m.get_priority();
+ //TODO: More tests?
+ for (treap_t::iterator ci = my_balancer.begin(); ci != my_balancer.end(); ++ci) {
+ treap_t::hierarchy_type::cursor c = ci.base().base();
+// int priority = c->metadata().get_priority(); // FIXME: Segfaults!
+// if (!c.empty()) {
+// BOOST_CHECK(priority
+// > c.begin()->metadata().get_priority());
+// }
+ }
+
+ //treap_t::iterator ci = my_balancer.begin();
+ //treap_t::hierarchy_type::cursor c;
+ //c = ci.base().base();
+ //c = c.parent();
+ //treap_t::metadata_type m = c->metadata();
+ //int i = ci.base().base().parent()->metadata().get_priority();//m.get_priority();
 }
 
 
 int test_main(int, char* [])
 {
- test_treap();
- return 0;
+ test_treap();
+ return 0;
 }

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/unbalanced_binary_tree_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/unbalanced_binary_tree_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/unbalanced_binary_tree_test.cpp 2008-09-17 16:54:25 EDT (Wed, 17 Sep 2008)
@@ -20,62 +20,62 @@
 
 void test_unbalanced_binary_tree()
 {
- using namespace boost::tree;
-
- typedef binary_tree<int> tree_t;
- typedef balanced_tree<tree_t, balancers::unbalanced> balancer_t;
- balancer_t my_tree;
-
- balancer_t::iterator c, c1, c2, c3, c4, c5;
-
- c = my_tree.end();
- BOOST_CHECK(c == my_tree.end());
- BOOST_CHECK(c == my_tree.begin());
-
- c1 = my_tree.insert(c, 8);
-
- BOOST_CHECK(*c1 == 8);
-
- c1 = my_tree.insert(c1, 7);
- BOOST_CHECK(*c1 == 7);
-
- ++c1;
- BOOST_CHECK(*c1 == 8);
-
- ++c1;
- BOOST_CHECK(c1 == my_tree.end());
-
- c1 = my_tree.insert(my_tree.end(), 10);
- BOOST_CHECK(*c1 == 10);
-
- --c1;
- BOOST_CHECK(*c1 == 8);
-
- --c1;
- BOOST_CHECK(*c1 == 7);
-
- c = my_tree.lower_bound(8);
- BOOST_CHECK(*c == 8);
-
- ++c;
- BOOST_CHECK(*c == 10);
- --c;
- BOOST_CHECK(*c == 8);
- --c;
- BOOST_CHECK(*c == 7);
- ++c;
- BOOST_CHECK(*c == 8);
- //c = my_tree.erase(c);
- --c;
- BOOST_CHECK(*c == 7);
-
+ using namespace boost::tree;
+
+ typedef binary_tree<int> tree_t;
+ typedef balanced_tree<tree_t, balancers::unbalanced> balancer_t;
+ balancer_t my_tree;
+
+ balancer_t::iterator c, c1, c2, c3, c4, c5;
+
+ c = my_tree.end();
+ BOOST_CHECK(c == my_tree.end());
+ BOOST_CHECK(c == my_tree.begin());
+
+ c1 = my_tree.insert(c, 8);
+
+ BOOST_CHECK(*c1 == 8);
+
+ c1 = my_tree.insert(c1, 7);
+ BOOST_CHECK(*c1 == 7);
+
+ ++c1;
+ BOOST_CHECK(*c1 == 8);
+
+ ++c1;
+ BOOST_CHECK(c1 == my_tree.end());
+
+ c1 = my_tree.insert(my_tree.end(), 10);
+ BOOST_CHECK(*c1 == 10);
+
+ --c1;
+ BOOST_CHECK(*c1 == 8);
+
+ --c1;
+ BOOST_CHECK(*c1 == 7);
+
+ c = my_tree.lower_bound(8);
+ BOOST_CHECK(*c == 8);
+
+ ++c;
+ BOOST_CHECK(*c == 10);
+ --c;
+ BOOST_CHECK(*c == 8);
+ --c;
+ BOOST_CHECK(*c == 7);
+ ++c;
+ BOOST_CHECK(*c == 8);
+ //c = my_tree.erase(c);
+ --c;
+ BOOST_CHECK(*c == 7);
+
 }
 
 //boost::unit_test::test_suite*
 //init_unit_test_suite( int argc, char* argv[] )
 //{
 // boost::unit_test::test_suite* key_search_test =
-// BOOST_TEST_SUITE( "Key search binary vector test" );
+// BOOST_TEST_SUITE( "Key search binary vector test" );
 //
 // key_search_test->add( BOOST_TEST_CASE( &key_search_binary_balancer_test ) );
 //
@@ -84,7 +84,7 @@
 
 int test_main(int, char* [])
 {
- test_unbalanced_binary_tree();
+ test_unbalanced_binary_tree();
 
- return 0;
+ return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk