Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49542 - in sandbox/SOC/2006/tree/trunk: boost/tree boost/tree/detail/algorithm libs/tree/test
From: ockham_at_[hidden]
Date: 2008-11-02 18:19:39


Author: bernhard.reiter
Date: 2008-11-02 18:19:38 EST (Sun, 02 Nov 2008)
New Revision: 49542
URL: http://svn.boost.org/trac/boost/changeset/49542

Log:
Minor fixes.
Text files modified:
   sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp | 3 +
   sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp | 3 -
   sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp | 5 +-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/helpers.hpp | 2 +
   sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp | 70 +++++++++++++++++++--------------------
   6 files changed, 42 insertions(+), 43 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/detail/algorithm/postorder.hpp 2008-11-02 18:19:38 EST (Sun, 02 Nov 2008)
@@ -188,6 +188,7 @@
 OutCursor transform(postorder, InCursor s, OutCursor t, Op op, forward_traversal_tag)
 {
     InCursor r = s;
+ //OutCursor t2 = t;
     s.to_begin();
     t.to_begin();
     
@@ -199,7 +200,7 @@
     if (!s.empty())
         transform(postorder(), s, t, op, forward_traversal_tag());
     
- *t = op(*r.to_begin());
+ *t/*2.to_begin()*/ = op(*r.to_begin());
     return t;
 }
 

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/root_tracking_cursor.hpp 2008-11-02 18:19:38 EST (Sun, 02 Nov 2008)
@@ -107,7 +107,7 @@
 };
 
 template <class Cursor>
-inline root_tracking_cursor<Cursor> make_root_tracking_cursor(Cursor c)
+inline root_tracking_cursor<Cursor> track_root(Cursor c)
 {
     return root_tracking_cursor<Cursor>(c);
 }

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-11-02 18:19:38 EST (Sun, 02 Nov 2008)
@@ -19,7 +19,6 @@
 #define BOOST_TEST_MODULE cursor_algorithm test
 #include <boost/test/included/unit_test.hpp>
 #include <boost/test/test_case_template.hpp>
-#include <boost/mpl/list.hpp>
 
 #include "helpers.hpp"
 #include "test_tree_traversal_data.hpp"
@@ -28,8 +27,6 @@
 
 BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, test_binary_tree_with_list_fixture<int>)
 
-typedef boost::mpl::list<preorder,inorder,postorder> orders;
-
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_foreach, Order, orders)
 {
     boost::tree::for_each(

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-11-02 18:19:38 EST (Sun, 02 Nov 2008)
@@ -24,7 +24,7 @@
 using namespace boost::tree;
 
 typedef boost::mpl::list< boost::mpl::pair<preorder, preorder>
- /*, boost::mpl::pair<postorder, inorder>*/ > order_pairs;
+ /*, boost::mpl::pair<postorder, inorder>*/ > corresponding_orders;
 
 BOOST_FIXTURE_TEST_SUITE(forest_algorithms_test, test_binary_tree_with_list_fixture<int>)
 
@@ -63,7 +63,8 @@
 
 }
 
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_natural_correspondence, Order, order_pairs )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_natural_correspondence, Order
+ , corresponding_orders )
 {
     using namespace boost::tree;
 

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-11-02 18:19:38 EST (Sun, 02 Nov 2008)
@@ -12,11 +12,13 @@
 #include <boost/tree/searcher.hpp>
 
 #include <boost/multi_index/identity.hpp>
+#include <boost/mpl/list.hpp>
 
 using namespace boost::tree;
 
 using boost::multi_index::identity;
 
+typedef boost::mpl::list<preorder,inorder,postorder> orders;
 
 /**
  * @brief test_balancer (exposes underlying hierarchy for test purposes)

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-11-02 18:19:38 EST (Sun, 02 Nov 2008)
@@ -86,16 +86,14 @@
 
 template <class Order>
 void comparisons_using_ac(binary_tree<int>::cursor c) {
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(c)));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(c)));
 }
 
 template <class Order>
 void comparisons_using_rtc(binary_tree<int>::cursor c) {
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(c));
+ compare_cursor_to_iterator_traversal(Order(), track_root(c));
 }
 
-typedef boost::mpl::list<preorder,inorder,postorder> orders;
-
 /**
  * Check all iterator traversals by comparing them to a recursive cursor
  * algorithm output. Do that at different stages of the tree while adding
@@ -112,48 +110,48 @@
     //test::compare_cursor_to_iterator_traversal(Order(), test_tree2.root());
 
     binary_tree<int>::cursor c = test_tree2.insert(test_tree2.root(), 8);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
 
     c = test_tree2.insert(c, 3);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
         
     test_tree2.insert(c, 1);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     c = test_tree2.insert(++c, 6);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     test_tree2.insert(c, 4);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     test_tree2.insert(++c, 7);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     c = test_tree2.insert(test_tree2.root().end(), 10);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     c = test_tree2.insert(test_tree2.root().end().end(), 14);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     c = test_tree2.insert(c, 13);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     c = test_tree2.insert(c, 11);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     c = test_tree2.insert(++c, 12);
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ compare_cursor_to_iterator_traversal(Order(), track_root(test_tree2.root()));
+ compare_cursor_to_iterator_traversal(Order(), track_root(make_ascending_cursor(test_tree2.root())));
     
     underefed_for_each(test_tree2.root(), comparisons_using_ac<Order>);
     underefed_for_each(test_tree2.root(), comparisons_using_rtc<Order>);
@@ -173,23 +171,23 @@
 // BOOST_CHECK(test_list.empty());
 
     //Preorder
- test_traversal(Order(), begin(Order(), make_root_tracking_cursor(bt.root())),
- end(Order(), make_root_tracking_cursor(bt.root())));
+ test_traversal(Order(), begin(Order(), track_root(bt.root())),
+ end(Order(), track_root(bt.root())));
 
- test_reverse_traversal(Order(), end(Order(), make_root_tracking_cursor(bt.root())),
- begin(Order(), make_root_tracking_cursor(bt.root())));
+ test_reverse_traversal(Order(), end(Order(), track_root(bt.root())),
+ begin(Order(), track_root(bt.root())));
                                     
- BOOST_CHECK(std::distance(begin(Order(), make_root_tracking_cursor(bt.root())),
- end(Order(), make_root_tracking_cursor(bt.root()))) == 11);
+ BOOST_CHECK(std::distance(begin(Order(), track_root(bt.root())),
+ end(Order(), track_root(bt.root()))) == 11);
 
     // TODO: Also check with binary_tree-specialized inorder begin()!
 
     // Now the iterators based on stack-based cursors (that don't use cursor.to_parent())
 
- test_traversal(Order(), begin(Order(), make_root_tracking_cursor(make_ascending_cursor(bt.root()))),
- end(Order(), make_root_tracking_cursor(make_ascending_cursor(bt.root()))));
- test_reverse_traversal(Order(), end(Order(), make_root_tracking_cursor(make_ascending_cursor(bt.root()))),
- begin(Order(), make_root_tracking_cursor(make_ascending_cursor(bt.root()))));
+ test_traversal(Order(), begin(Order(), track_root(make_ascending_cursor(bt.root()))),
+ end(Order(), track_root(make_ascending_cursor(bt.root()))));
+ test_reverse_traversal(Order(), end(Order(), track_root(make_ascending_cursor(bt.root()))),
+ begin(Order(), track_root(make_ascending_cursor(bt.root()))));
 
 // TODO: Move to other unit
     //Ascending iterator.


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