Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51838 - in sandbox/SOC/2006/tree/trunk: . boost/tree boost/tree/detail libs/tree/example libs/tree/test
From: ockham_at_[hidden]
Date: 2009-03-18 10:51:07


Author: bernhard.reiter
Date: 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
New Revision: 51838
URL: http://svn.boost.org/trac/boost/changeset/51838

Log:
Various cleanup.
Added:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test_data.hpp
      - copied, changed from r51837, /sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp
Text files modified:
   sandbox/SOC/2006/tree/trunk/TODO | 8 -
   sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp | 8 +-
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_cursor.hpp | 6 +
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp | 34 +++++++---
   sandbox/SOC/2006/tree/trunk/libs/tree/example/for_each.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test_data.hpp | 120 ------------------------------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/graph_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp | 130 +++++++++++++--------------------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/to_first_test.cpp | 3
   sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp | 3
   11 files changed, 84 insertions(+), 234 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/TODO
==============================================================================
--- sandbox/SOC/2006/tree/trunk/TODO (original)
+++ sandbox/SOC/2006/tree/trunk/TODO 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -16,7 +16,6 @@
 General:
 * Do we need to_{left|right}most_ancestor?
 * Do we need multiway and plain cursor "flavor" tags (for algorithms)?
-* Fix cursor archetype
 * In case of forest cursor, is_leaf() should really be empty().
 * Further reduce test data redundancy: make mock cursor use the data from fake_binary_tree,
   and give it an Order template argument. Calculate *order positions from level order indices
@@ -30,18 +29,17 @@
   (The data pairs position--value
   are always the same, but the order in which they are accessed depends on the order of the
   algorithm acting on them).
-* Get rid of lists used for order checking. Use mock cursor instead.
 * Clean up binary_tree_test
-* binary_tree_search_test -> lower_bound_test
 * preorder_insert_cursor: hopefully easy to implement...
 * Add checks for correspondence of concepts and archetypes!
 * Re-do forest (again!).
   This seems to raise one issue, though: subtree algorithms operate on subtree root cursors,
- not ranges. (They might, however, work for "subforests". Consult Austern's segmented
+ not ranges.* binary_tree_search_test -> lower_bound_test
+ (They might, however, work for "subforests". Consult Austern's segmented
   iterators paper!)
   They also work for the important special case in which forest consists of only one
   subtree!
-* Improve cursor_archetype. Currently, there's trouble eg with constructors.
+* Fix cursor_archetype. Currently, there's trouble eg with constructors.
 * Remove a cursor's cursor, const_cursor, iterator and const_iterator typedefs?
   The latter two only make sense in a range algorithm context, where they might actually be
   useful. (The former two are just aliases for completeness' sake.)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/binary_tree.hpp 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -329,7 +329,7 @@
                 return;
                 
             m_header.m_children[0] = other.m_header.m_children[0];
- m_header.m_children[0]->m_parent = &m_header;
+ static_cast<node_base_pointer>(m_header.m_children[0])->m_parent = &m_header;
 
             m_header.m_children[1] = other.m_header.m_children[1];
             //m_header.m_parent = other.m_header.m_parent;
@@ -343,7 +343,7 @@
         
         if (other.empty()) {
             other.m_header.m_children[0] = m_header.m_children[0];
- other.m_header.m_children[0]->m_parent = &other.m_header;
+ static_cast<node_base_pointer>(other.m_header.m_children[0])->m_parent = &other.m_header;
             
             other.m_header.m_children[1] = m_header.m_children[1];
             //other.m_header.m_parent = m_header.m_parent;
@@ -357,8 +357,8 @@
         
         swap(m_header, other.m_header);
         //swap(m_header.m_children[0]->m_parent, other.m_header.m_children[0]->m_parent);
- m_header.m_children[0]->m_parent = &m_header;
- other.m_header.m_children[0]->m_parent = &other.m_header;
+ static_cast<node_base_pointer>(m_header.m_children[0])->m_parent = &m_header;
+ static_cast<node_base_pointer>(other.m_header.m_children[0])->m_parent = &other.m_header;
         
         return;
     }

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_cursor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_cursor.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_cursor.hpp 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -172,7 +172,8 @@
 
     void left()
     {
- this->base_reference() = this->base_reference()->m_children[m_pos];
+ this->base_reference() =
+ static_cast<node_base*>(this->base_reference()->m_children[m_pos]);
         m_pos = 0;
         //this->base_reference() = this->base_reference()->operator[0];
     }
@@ -180,7 +181,8 @@
     void right()
     {
         size_type new_pos = this->base_reference()->m_children.size()-1;
- this->base_reference() = this->base_reference()->m_children[m_pos];
+ this->base_reference() =
+ static_cast<node_base*>(this->base_reference()->m_children[m_pos]);
         m_pos = new_pos;
         //this->base_reference() = this->base_reference()->operator[0];
     }

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/nary_node.hpp 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -56,6 +56,11 @@
     {
         return m_parent;
     }
+
+ void attach(node_with_parent_base* p_node)
+ {
+ p_node->m_parent = this;
+ }
 };
 
 //template <template <typename> class Container>
@@ -105,10 +110,11 @@
 //};
 
 class node_base;
+class node_with_children_base;
 
 class node_with_children_base {
 public:
- typedef array<node_base*, 2> children_type;
+ typedef array<node_with_children_base*, 2> children_type;
     
     node_with_children_base()
     {
@@ -120,6 +126,15 @@
         for (children_type::size_type i=0; i<children_type::size(); ++i)
             m_children[i] = 0;
     }
+
+ void attach(node_with_children_base* p_node, children_type::size_type m_pos)
+ {
+ // Only relevant for non-leaf insertion:
+ p_node->m_children[m_pos] = m_children[m_pos];
+
+ m_children[m_pos] = p_node;
+ }
+
 //protected:
     children_type m_children;
 };
@@ -164,9 +179,9 @@
     children_type::size_type rotate(children_type::size_type const& c)
     {
         //TODO: Optimise.
- base_pointer q = m_children[c];
+ base_pointer q = static_cast<node_base*>(m_children[c]);
         
- base_pointer B = m_children[c]->m_children[(c ? 0 : 1)];
+ base_pointer B = static_cast<node_base*>(m_children[c]->m_children[(c ? 0 : 1)]);
         //pre_rotate();
         
         //B swaps places with its m_parent:
@@ -185,24 +200,23 @@
 
     void attach(base_pointer p_node, children_type::size_type m_pos)
     {
- p_node->m_parent = this;
+ node_with_parent_base::attach(p_node);
         
         // Only relevant for non-leaf insertion:
         if (m_children[m_pos] != 0)
- m_children[m_pos]->m_parent = p_node;
- p_node->m_children[m_pos] = m_children[m_pos];
+ static_cast<node_base*>(m_children[m_pos])->m_parent = p_node;
 
- m_children[m_pos] = p_node;
+ node_with_children_base::attach(p_node, m_pos);
     }
     
     base_pointer detach(children_type::size_type m_pos)
     {
- base_pointer q = m_children[m_pos];
+ base_pointer q = static_cast<node_base*>(m_children[m_pos]);
         m_children[m_pos] =
             m_children[m_pos]
           ->m_children[((m_children[m_pos])
           ->m_children[0] == 0 ? 1 : 0)];
- m_children[m_pos]->m_parent = this;
+ static_cast<node_base*>(m_children[m_pos])->m_parent = this;
         return q;
     }
     
@@ -221,7 +235,7 @@
 
         for (children_type::size_type i=0; i<children_type::max_size(); ++i) {
             m_children[i] = other->m_children[i];
- m_children[i]->m_parent = this;
+ static_cast<node_base*>(m_children[i])->m_parent = this;
         }
         return x;
     }

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 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -11,7 +11,7 @@
 
 #include <iostream>
 
-#include "../test/test_tree_traversal_data.hpp"
+#include "../test/binary_tree_test_data.hpp"
 
 using namespace boost::tree;
 

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 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -12,7 +12,7 @@
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 
-//
+#include "binary_tree_test_data.hpp"
 #include "test_tree_traversal_data.hpp"
 #include "fake_binary_tree.hpp"
 

Copied: sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test_data.hpp (from r51837, /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/binary_tree_test_data.hpp 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -4,17 +4,10 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#ifndef LIBS_TREE_TEST_TEST_TREE_TRAVERSAL_HPP
-#define LIBS_TREE_TEST_TEST_TREE_TRAVERSAL_HPP
+#ifndef LIBS_TREE_BINARY_TREE_TEST_DATA_HPP
+#define LIBS_TREE_BINARY_TREE_TEST_DATA_HPP
 
 #include <boost/tree/binary_tree.hpp>
-#include <boost/tree/algorithm.hpp>
-
-#include <boost/mpl/list.hpp>
-
-typedef boost::mpl::list<boost::tree::preorder
- ,boost::tree::inorder
- ,boost::tree::postorder> orders;
 
 template <class T = int>
 struct test_binary_tree_fixture {
@@ -56,115 +49,8 @@
         // Now insert 13 as left child of 14, which makes it 11's parent
         ret.insert(ret.root().end().end().begin(), value_type(13));
     }
-
- template <class Cursor>
- static void validate_test_dataset1_tree(Cursor cur)
- {
- BOOST_CHECK_EQUAL(*cur.begin(), 8);
- BOOST_CHECK_EQUAL(*cur.begin().begin(), 3);
- BOOST_CHECK_EQUAL(*cur.begin().begin().begin(), 1);
- BOOST_CHECK(cur.begin().begin().end().is_leaf());
- BOOST_CHECK(cur.begin().begin().begin().is_leaf()); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.begin().end().begin(), 6);
- BOOST_CHECK_EQUAL(*cur.begin().end().begin().begin(), 4);
- BOOST_CHECK(cur.begin().end().begin().begin().is_leaf()); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.begin().end().end().begin(), 7);
- BOOST_CHECK(cur.begin().end().end().begin().is_leaf()); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.end().begin(), 10);
- BOOST_CHECK(cur.end().begin().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin(), 14);
- BOOST_CHECK(cur.end().end().end().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin(), 13);
- BOOST_CHECK(cur.end().end().begin().end().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().begin(), 11);
- BOOST_CHECK(cur.end().end().begin().begin().begin().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().end().begin(), 12);
- BOOST_CHECK(cur.end().end().begin().begin().end().begin().is_leaf()); //Leaf
- }
 
- static void validate_test_dataset1_minus_1_tree(typename boost::tree::binary_tree<T>::const_cursor cur)
- {
- BOOST_CHECK_EQUAL(*cur.begin(), 7);
- BOOST_CHECK_EQUAL(*cur.begin().begin(), 2);
- BOOST_CHECK_EQUAL(*cur.begin().begin().begin(), 0); //Leaf
- BOOST_CHECK_EQUAL(*cur.begin().end().begin(), 5);
- BOOST_CHECK_EQUAL(*cur.begin().end().begin().begin(), 3); //Leaf
- BOOST_CHECK_EQUAL(*cur.begin().end().end().begin(), 6); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.end().begin(), 9);
- BOOST_CHECK_EQUAL(*cur.end().end().begin(), 13);
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin(), 12);
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().begin(), 10);
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().end().begin(), 11); //Leaf
- }
-
     boost::tree::binary_tree<T> bt, bt2;
 };
 
-template <class Container>
-void generate_mock_cursor_data(boost::tree::preorder, Container& data)
-{
- using std::make_pair;
- data[0] = make_pair(0, 8);
- data[1] = make_pair(1, 3);
- data[2] = make_pair(3, 1);
- data[3] = make_pair(4, 6);
- data[4] = make_pair(9, 4);
- data[5] = make_pair(10, 7);
- data[6] = make_pair(2, 10);
- data[7] = make_pair(6, 14);
- data[8] = make_pair(13, 13);
- data[9] = make_pair(27, 11);
- data[10] = make_pair(56, 12);
-}
-
-template <class Container>
-void generate_mock_cursor_data(boost::tree::inorder, Container& data)
-{
- using std::make_pair;
- data[0] = make_pair(3, 1);
- data[1] = make_pair(1, 3);
- data[2] = make_pair(9, 4);
- data[3] = make_pair(4, 6);
- data[4] = make_pair(10, 7);
- data[5] = make_pair(0, 8);
- data[6] = make_pair(2, 10);
- data[7] = make_pair(27, 11);
- data[8] = make_pair(56, 12);
- data[9] = make_pair(13, 13);
- data[10] = make_pair(6, 14);
-}
-
-template <class Container>
-void generate_mock_cursor_data(boost::tree::postorder, Container& data)
-{
- using std::make_pair;
- data[0] = make_pair(3, 1);
- data[1] = make_pair(9, 4);
- data[2] = make_pair(10, 7);
- data[3] = make_pair(4, 6);
- data[4] = make_pair(1, 3);
- data[5] = make_pair(56, 12);
- data[6] = make_pair(27, 11);
- data[7] = make_pair(13, 13);
- data[8] = make_pair(6, 14);
- data[9] = make_pair(2, 10);
- data[10] = make_pair(0, 8);
-}
-
-template <class Iterator>
-void test_traversal_from_leaf4(Iterator a, Iterator b)
-{
- BOOST_CHECK_EQUAL(*a, 4);
- BOOST_CHECK_EQUAL(*++a, 6);
- BOOST_CHECK_EQUAL(*++a, 3);
- BOOST_CHECK_EQUAL(*++a, 8);
- BOOST_CHECK(++a == b);
-
-} // namespace ascending
-
-
-#endif // LIBS_TREE_TEST_TEST_TREE_TRAVERSAL_HPP
+#endif // LIBS_TREE_BINARY_TREE_TEST_DATA_HPP

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 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -18,8 +18,8 @@
 
 #include <boost/tree/balance.hpp>
 
-
 #include "test_tree_traversal_data.hpp"
+#include "binary_tree_test_data.hpp" // TODO: Remove
 
 typedef boost::tree::augmented_type< int, boost::default_color_type > data_type;
 

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 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -7,7 +7,6 @@
 #ifndef LIBS_TREE_TEST_TEST_TREE_TRAVERSAL_HPP
 #define LIBS_TREE_TEST_TEST_TREE_TRAVERSAL_HPP
 
-#include <boost/tree/binary_tree.hpp>
 #include <boost/tree/algorithm.hpp>
 
 #include <boost/mpl/list.hpp>
@@ -15,94 +14,51 @@
 typedef boost::mpl::list<boost::tree::preorder
                         ,boost::tree::inorder
                         ,boost::tree::postorder> orders;
-
-template <class T = int>
-struct test_binary_tree_fixture {
- test_binary_tree_fixture()
- {
- create_test_dataset1_tree(bt);
- create_test_dataset1_tree(bt2);
-
- typename boost::tree::binary_tree<T>::cursor d = bt2.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 = T(29);
- }
-
- // Test data from http://en.wikipedia.org/wiki/Image:Binary_search_tree.svg
- // (With two additional nodes: 11 inserted left of 13; 12 right of 11)
- // and in combination with http://en.wikipedia.org/wiki/Tree_traversal#Examples
- // (as tree shapes are equal [apart from the extra nodes])
- static void create_test_dataset1_tree(boost::tree::binary_tree<T>& ret)
- {
- // For augmented trees. (Why is this necessary? Nothing here is explicit!)
- typedef typename boost::tree::binary_tree<T>::value_type value_type;
-
- typename boost::tree::binary_tree<T>::cursor cur = ret.insert(ret.root(), value_type(8));
- cur = ret.insert(cur.to_begin(), value_type(3));
- ret.insert(cur.to_begin(), value_type(1));
- cur = ret.insert(++cur, value_type(6));
- ret.insert(cur.to_begin(), 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.to_begin(), value_type(13));
- // First insert 11 as left child of 14, 12 as child of 11
- cur = ret.insert(cur.to_begin(), value_type(11));
- cur = ret.insert(++cur.to_begin(), value_type(12));
- // Now insert 13 as left child of 14, which makes it 11's parent
- ret.insert(ret.root().end().end().begin(), value_type(13));
- }
     
- template <class Cursor>
- static void validate_test_dataset1_tree(Cursor cur)
- {
- BOOST_CHECK_EQUAL(*cur.begin(), 8);
- BOOST_CHECK_EQUAL(*cur.begin().begin(), 3);
- BOOST_CHECK_EQUAL(*cur.begin().begin().begin(), 1);
- BOOST_CHECK(cur.begin().begin().end().is_leaf());
- BOOST_CHECK(cur.begin().begin().begin().is_leaf()); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.begin().end().begin(), 6);
- BOOST_CHECK_EQUAL(*cur.begin().end().begin().begin(), 4);
- BOOST_CHECK(cur.begin().end().begin().begin().is_leaf()); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.begin().end().end().begin(), 7);
- BOOST_CHECK(cur.begin().end().end().begin().is_leaf()); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.end().begin(), 10);
- BOOST_CHECK(cur.end().begin().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin(), 14);
- BOOST_CHECK(cur.end().end().end().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin(), 13);
- BOOST_CHECK(cur.end().end().begin().end().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().begin(), 11);
- BOOST_CHECK(cur.end().end().begin().begin().begin().is_leaf());
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().end().begin(), 12);
- BOOST_CHECK(cur.end().end().begin().begin().end().begin().is_leaf()); //Leaf
- }
-
- static void validate_test_dataset1_minus_1_tree(typename boost::tree::binary_tree<T>::const_cursor cur)
- {
- BOOST_CHECK_EQUAL(*cur.begin(), 7);
- BOOST_CHECK_EQUAL(*cur.begin().begin(), 2);
- BOOST_CHECK_EQUAL(*cur.begin().begin().begin(), 0); //Leaf
- BOOST_CHECK_EQUAL(*cur.begin().end().begin(), 5);
- BOOST_CHECK_EQUAL(*cur.begin().end().begin().begin(), 3); //Leaf
- BOOST_CHECK_EQUAL(*cur.begin().end().end().begin(), 6); //Leaf
-
- BOOST_CHECK_EQUAL(*cur.end().begin(), 9);
- BOOST_CHECK_EQUAL(*cur.end().end().begin(), 13);
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin(), 12);
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().begin(), 10);
- BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().end().begin(), 11); //Leaf
- }
+template <class Cursor>
+static void validate_test_dataset1_tree(Cursor cur)
+{
+ BOOST_CHECK_EQUAL(*cur.begin(), 8);
+ BOOST_CHECK_EQUAL(*cur.begin().begin(), 3);
+ BOOST_CHECK_EQUAL(*cur.begin().begin().begin(), 1);
+ BOOST_CHECK(cur.begin().begin().end().is_leaf());
+ BOOST_CHECK(cur.begin().begin().begin().is_leaf()); //Leaf
     
- boost::tree::binary_tree<T> bt, bt2;
-};
+ BOOST_CHECK_EQUAL(*cur.begin().end().begin(), 6);
+ BOOST_CHECK_EQUAL(*cur.begin().end().begin().begin(), 4);
+ BOOST_CHECK(cur.begin().end().begin().begin().is_leaf()); //Leaf
+
+ BOOST_CHECK_EQUAL(*cur.begin().end().end().begin(), 7);
+ BOOST_CHECK(cur.begin().end().end().begin().is_leaf()); //Leaf
+
+ BOOST_CHECK_EQUAL(*cur.end().begin(), 10);
+ BOOST_CHECK(cur.end().begin().is_leaf());
+ BOOST_CHECK_EQUAL(*cur.end().end().begin(), 14);
+ BOOST_CHECK(cur.end().end().end().is_leaf());
+ BOOST_CHECK_EQUAL(*cur.end().end().begin().begin(), 13);
+ BOOST_CHECK(cur.end().end().begin().end().is_leaf());
+ BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().begin(), 11);
+ BOOST_CHECK(cur.end().end().begin().begin().begin().is_leaf());
+ BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().end().begin(), 12);
+ BOOST_CHECK(cur.end().end().begin().begin().end().begin().is_leaf()); //Leaf
+}
+
+template <class Cursor>
+static void validate_test_dataset1_minus_1_tree(Cursor cur)
+{
+ BOOST_CHECK_EQUAL(*cur.begin(), 7);
+ BOOST_CHECK_EQUAL(*cur.begin().begin(), 2);
+ BOOST_CHECK_EQUAL(*cur.begin().begin().begin(), 0); //Leaf
+ BOOST_CHECK_EQUAL(*cur.begin().end().begin(), 5);
+ BOOST_CHECK_EQUAL(*cur.begin().end().begin().begin(), 3); //Leaf
+ BOOST_CHECK_EQUAL(*cur.begin().end().end().begin(), 6); //Leaf
+
+ BOOST_CHECK_EQUAL(*cur.end().begin(), 9);
+ BOOST_CHECK_EQUAL(*cur.end().end().begin(), 13);
+ BOOST_CHECK_EQUAL(*cur.end().end().begin().begin(), 12);
+ BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().begin(), 10);
+ BOOST_CHECK_EQUAL(*cur.end().end().begin().begin().end().begin(), 11); //Leaf
+}
 
 template <class Container>
 void generate_mock_cursor_data(boost::tree::preorder, Container& data)

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/to_first_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/to_first_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/to_first_test.cpp 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -10,9 +10,6 @@
 #include <boost/test/included/unit_test.hpp>
 #include <boost/test/test_case_template.hpp>
 
-
-#include "test_tree_traversal_data.hpp"
-
 #include "fake_binary_tree.hpp"
 
 using namespace boost::tree;

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp 2009-03-18 10:51:05 EDT (Wed, 18 Mar 2009)
@@ -10,9 +10,6 @@
 #include <boost/test/included/unit_test.hpp>
 #include <boost/test/test_case_template.hpp>
 
-
-#include "test_tree_traversal_data.hpp"
-
 #include "fake_binary_tree.hpp"
 
 using namespace boost::tree;


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