Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49101 - sandbox/SOC/2006/tree/trunk/libs/tree/test
From: ockham_at_[hidden]
Date: 2008-10-01 18:50:29


Author: bernhard.reiter
Date: 2008-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
New Revision: 49101
URL: http://svn.boost.org/trac/boost/changeset/49101

Log:
Test cleanup continued.
Text files modified:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_search_test.cpp | 29 +++++++-------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test.cpp | 38 ++++++++++---------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp | 71 ++++++++----------------------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp | 21 +++-------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/graph_test.cpp | 51 ++++++++++++++------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/interval_search_binary_tree_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp | 29 +++++++-------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/key_search_binary_tree_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/multiway_tree_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/nary_tree_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/range_helpers_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/red_black_tree_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/rotate_binary_tree_test.cpp | 19 +++++----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/search_ordered_vector_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/string_search_binary_tree_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp | 76 ++++++++++++++++++++++++++++-----------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/treap_test.cpp | 2
   sandbox/SOC/2006/tree/trunk/libs/tree/test/unbalanced_binary_tree_test.cpp | 2
   18 files changed, 176 insertions(+), 178 deletions(-)

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -23,6 +23,8 @@
 
 using namespace boost::tree;
 
+BOOST_FIXTURE_TEST_SUITE(binary_tree_search_test, test_binary_tree_with_list_fixture<int>)
+
 void search_single_element(binary_tree<int>::const_cursor r, int v)
 {
     binary_tree<int>::const_cursor c, d;
@@ -34,34 +36,33 @@
 }
 
 BOOST_AUTO_TEST_CASE( binary_tree_search_test )
-{
- 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(bt.root(), 4); // (Left) Leaf
+ search_single_element(bt.root(), 7); // (Right) Leaf
+ search_single_element(bt.root(), 6); // Non-Leaf
+ search_single_element(bt.root(), 8); // root().begin()
 
- c = lower_bound(test_tree.root(), 5); // Not in tree
- d = lower_bound(test_tree.root(), 5);
+ c = lower_bound(bt.root(), 5); // Not in tree
+ d = lower_bound(bt.root(), 5);
     BOOST_CHECK(*c == 6);
     BOOST_CHECK(*d == 6);
     
     *c = 4;
     
- c = lower_bound(test_tree.root(), 5); // Not in tree
+ c = lower_bound(bt.root(), 5); // Not in tree
     BOOST_CHECK(*c == 7);
 
- c = lower_bound(test_tree.root(), 4); // Twice in tree
- d = upper_bound(test_tree.root(), 4);
+ c = lower_bound(bt.root(), 4); // Twice in tree
+ d = upper_bound(bt.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);
+ validate_test_data_tree(bt);
 }
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -15,7 +15,7 @@
 #include "helpers.hpp"
 #include "test_tree_traversal_data.hpp"
 
-//TODO: Make this a test suite.
+BOOST_FIXTURE_TEST_SUITE(graph_algorithms_test, test_binary_tree_with_list_fixture<int>)
 
 using namespace boost::tree;
 
@@ -175,37 +175,37 @@
     BOOST_CHECK(tree2.empty());
     
     // Fill empty tree2 with different data
- create_test_data_tree(tree2);
- validate_test_data_tree(tree2);
- BOOST_CHECK(tree1 != tree2);
+ //create_test_data_tree(tree2);
+ validate_test_data_tree(bt);
+ BOOST_CHECK(tree1 != bt);
     
     // Swap
- test_swap_binary_trees(tree1, tree2);
+ test_swap_binary_trees(tree1, bt);
     validate_test_data_tree(tree1);
- validate_binary_tree(tree2);
+ validate_binary_tree(bt);
     
- destroy_binary_tree(tree2);
+ destroy_binary_tree(bt);
 
     // Insert subtree
- tree_t::cursor c = tree2.insert(tree2.root(), tree1.root());
+ tree_t::cursor c = bt.insert(bt.root(), tree1.root());
     BOOST_CHECK(*c == 8);
- validate_test_data_tree(tree2);
+ validate_test_data_tree(bt);
     
     // Copy constructor
- tree_t tree3(tree2);
+ tree_t tree3(bt);
     validate_test_data_tree(tree3);
- BOOST_CHECK(tree2 == tree3);
+ BOOST_CHECK(bt == tree3);
     
     // Change one value in test_tree3
     c = tree3.root().begin().end().begin().begin();
     int tmp = *c;
     *c = tmp + 1;
- BOOST_CHECK(tree2 != tree3);
+ BOOST_CHECK(bt != tree3);
 
     // Change it back
     c = tree3.root().begin().end().begin().begin();
     *c = tmp;
- BOOST_CHECK(tree2 == tree3);
+ BOOST_CHECK(bt == tree3);
     
     c = tree3.inorder_first();
     BOOST_CHECK(*c == 1);
@@ -213,15 +213,17 @@
     //inorder::back(c);
     //BOOST_CHECK(*c == 14);
     
- destroy_binary_tree(tree2);
- tree2.splice(tree2.root(), tree3);
+ destroy_binary_tree(bt);
+ bt.splice(bt.root(), tree3);
 
     BOOST_CHECK(tree3.empty());
- validate_test_data_tree(tree2);
- c = tree2.inorder_first();
+ validate_test_data_tree(bt);
+ c = bt.inorder_first();
     BOOST_CHECK(*c == 1);
 
- inorder_erase_test_data_tree(tree2);
+ inorder_erase_test_data_tree(bt);
     
     //return 0;
 }
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -24,71 +24,34 @@
 
 using namespace boost::tree;
 
-template <class Order, class Cursor, class Container>
-void test_for_each(Order, Cursor c, Container& cont)
+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(
         Order(),
- c,
- boost::lambda::bind(&Container::push_back, &cont, boost::lambda::_1)
+ bt.root(),
+ boost::lambda::bind(&std::list<int>::push_back, &l, boost::lambda::_1)
     );
- test_traversal(Order(), cont.begin(), cont.end());
+ test_traversal(Order(), l.begin(), l.end());
 }
 
-template <class Order, class Cursor, class OutCursor, class Container>
-void test_copy(Order, Cursor c, OutCursor& o, Container& cont)
-{
- boost::tree::copy(Order(), c, o);
- test_traversal(Order(), cont.begin(), cont.end());
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_copy, Order, orders)
+{
+ boost::tree::copy(Order(), bt.root(), o);
+ test_traversal(Order(), l.begin(), l.end());
 }
 
-template <class Order, class Cursor, class OutCursor, class Container>
-void test_transform(Order, Cursor c, Cursor d, OutCursor& o, Container& cont)
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_transform, Order, orders)
 {
     // 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::transform(Order(), c, d, std::bind2nd(std::plus<int>(),1));
- boost::tree::transform(Order(), d, o, std::bind2nd(std::minus<int>(),1));
- test_traversal(Order(), cont.begin(), cont.end());
-}
-
-template <class Order, class Cursor>
-void algorithms(Order, 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(Order(), c, test_list);
-
- test_list.clear();
- test_copy(Order(), c, oc_test_list, test_list);
-
- test_list.clear();
- test_transform(Order(), c, d, oc_test_list, test_list);
+ boost::tree::transform(Order(), bt.root(), bt2.root(), std::bind2nd(std::plus<int>(),1));
+ boost::tree::transform(Order(), bt2.root(), o, std::bind2nd(std::minus<int>(),1));
+ test_traversal(Order(), l.begin(), l.end());
 }
 
-typedef boost::mpl::list<preorder,inorder,postorder> orders;
-
-BOOST_AUTO_TEST_CASE_TEMPLATE( test_algorithms, Order, orders )
-{
- 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();
-
- algorithms(Order(), test_tree.root(), test_tree2.root());
-}
+BOOST_AUTO_TEST_SUITE_END()

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -11,15 +11,15 @@
 
 #include <list>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE forest_tree test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 
 #include "test_tree_traversal_data.hpp"
 
-//TODO: Make this a test suite.
+BOOST_FIXTURE_TEST_SUITE(forest_algorithms_test, test_binary_tree_with_list_fixture<int>)
 
-void test_forest_tree()
+BOOST_AUTO_TEST_CASE( forest_tree_test )
 {
     using namespace boost::tree;
     
@@ -54,14 +54,10 @@
 
 }
 
-void test_natural_correspondence()
+BOOST_AUTO_TEST_CASE( 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);
     
@@ -103,8 +99,5 @@
     BOOST_CHECK(test_list.size() == 11);
 }
 
-BOOST_AUTO_TEST_CASE( forest_tree_test )
-{
- test_forest_tree();
- test_natural_correspondence();
-}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -9,7 +9,7 @@
 #include <boost/graph/depth_first_search.hpp>
 #include <boost/graph/visitors.hpp>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE graph test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 
@@ -19,19 +19,22 @@
 #include "helpers.hpp"
 #include "test_tree_traversal_data.hpp"
 
+typedef augmented_type< int, boost::default_color_type > data_type;
+
+BOOST_FIXTURE_TEST_SUITE(graph_algorithms_test, test_binary_tree_with_list_fixture<data_type>)
+
 BOOST_AUTO_TEST_CASE( graph_test )
 {
     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);
+ //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;
@@ -56,13 +59,13 @@
         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());
+ BOOST_CHECK(get(dpm, bt.root()) == 8); // Check the entire tree?
+ BOOST_CHECK(get(cpm, bt.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());
+ put(cpm, bt.root(), Color::gray());
+ BOOST_CHECK(get(cpm, bt.root()) == Color::gray());
+ put(cpm, bt.root(), Color::white());
+ BOOST_CHECK(get(cpm, bt.root()) == Color::white());
     
     boost::dfs_visitor<
         boost::property_writer<
@@ -76,33 +79,33 @@
         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>);
+// boost::depth_first_visit(bt, bt.root(), preorder_writer, cpm, empty_cursor<tree_type>);
     
- graph_traits<tree_type>::vertex_descriptor v = test_tree.root();
+ graph_traits<tree_type>::vertex_descriptor v = bt.root();
     
     graph_traits<tree_type>::out_edge_iterator oei, oei_end;
- tie(oei, oei_end) = out_edges(v, test_tree);
+ tie(oei, oei_end) = out_edges(v, bt);
     
- cursor w = target(*oei, test_tree);
+ cursor w = target(*oei, bt);
     
- w = test_tree.root().begin().end().begin();
+ w = bt.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(!empty_cursor(v, bt));
     
     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(source(*oei, bt) == bt.root());
+ BOOST_CHECK(source(*oei_end, bt) == bt.root());
     
- BOOST_CHECK(target(*oei, test_tree) == test_tree.root().begin());
- BOOST_CHECK(target(*oei_end, test_tree) == test_tree.root());
+ BOOST_CHECK(target(*oei, bt) == bt.root().begin());
+ BOOST_CHECK(target(*oei_end, bt) == bt.root());
     
- BOOST_CHECK(out_degree(v, test_tree) == 2);
+ BOOST_CHECK(out_degree(v, bt) == 2);
 //
 // BOOST_CHECK(test_list.size() == 2);
 //
@@ -113,6 +116,8 @@
     
 // test::preorder::traversal(test_list.begin(), test_list.end());
     
- // Output test_tree using write_graphviz. This might require copying
+ // Output bt using write_graphviz. This might require copying
     // the IncidenceGraph to a VertexListGraph (using copy_component)
 }
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -11,7 +11,7 @@
 //#include <boost/numeric/interval/compare/lexicographic.hpp>
 #include <boost/multi_index/identity.hpp>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE interval_search test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -23,6 +23,8 @@
 
 using namespace boost::tree;
 
+BOOST_FIXTURE_TEST_SUITE( iterator_algorithms_test, test_binary_tree_with_list_fixture<int> )
+
 template <class Order, class Cursor>
 void compare_cursor_to_iterator_traversal(Order, Cursor cur) {
     std::list<int> test_list;
@@ -160,8 +162,7 @@
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_algorithms, Order, orders )
 {
     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.
@@ -171,26 +172,24 @@
 // );
 // BOOST_CHECK(test_list.empty());
 
- create_test_data_tree(test_tree);
-
     //Preorder
- test_traversal(Order(), begin(Order(), make_root_tracking_cursor(test_tree.root())),
- end(Order(), make_root_tracking_cursor(test_tree.root())));
+ test_traversal(Order(), begin(Order(), make_root_tracking_cursor(bt.root())),
+ end(Order(), make_root_tracking_cursor(bt.root())));
 
- test_reverse_traversal(Order(), end(Order(), make_root_tracking_cursor(test_tree.root())),
- begin(Order(), make_root_tracking_cursor(test_tree.root())));
+ test_reverse_traversal(Order(), end(Order(), make_root_tracking_cursor(bt.root())),
+ begin(Order(), make_root_tracking_cursor(bt.root())));
                                     
- BOOST_CHECK(std::distance(begin(Order(), make_root_tracking_cursor(test_tree.root())),
- end(Order(), make_root_tracking_cursor(test_tree.root()))) == 11);
+ BOOST_CHECK(std::distance(begin(Order(), make_root_tracking_cursor(bt.root())),
+ end(Order(), make_root_tracking_cursor(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(test_tree.root()))),
- end(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
- test_reverse_traversal(Order(), end(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))),
- begin(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree.root()))));
+ 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()))));
 
 // TODO: Move to other unit
     //Ascending iterator.
@@ -204,4 +203,4 @@
 
 }
 
-
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -10,7 +10,7 @@
 #include <boost/tree/searcher.hpp>
 #include <boost/tree/algorithm.hpp>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE key_search test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -6,7 +6,7 @@
 
 #include <boost/tree/multiway_tree.hpp>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE multiway_tree test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -6,7 +6,7 @@
 
 #include <boost/tree/nary_tree.hpp>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE nary_tree test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -6,7 +6,7 @@
 
 #include <boost/tree/detail/range_helpers.hpp>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE range_helpers test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -11,7 +11,7 @@
 #include <vector>
 #include <algorithm>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE red_black_tree test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -11,21 +11,20 @@
 #include "helpers.hpp"
 #include "test_tree_traversal_data.hpp"
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE rotate_binary_tree test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 
 using boost::tree::binary_tree;
 
-//TODO: Make this a test suite.
+BOOST_FIXTURE_TEST_SUITE(rotate_binary_tree_test, test_binary_tree_with_list_fixture<int>)
 
-BOOST_AUTO_TEST_CASE( rotate_binary_tree_test )
+BOOST_AUTO_TEST_CASE( rotate_binary_tree_test1 )
 {
- binary_tree<int> a;
- binary_tree<int> mytree(a);
+ //binary_tree<int> a;
 
- create_test_data_tree(mytree);
- binary_tree<int>::cursor c = mytree.root().begin().end();
+ //create_test_data_tree(bt);
+ binary_tree<int>::cursor c = bt.root().begin().end();
     BOOST_CHECK(*c.begin() == 6);
 
     BOOST_CHECK(*c.parent() == 8);
@@ -39,7 +38,7 @@
     BOOST_CHECK(c.parity() == 1);
     BOOST_CHECK(*c.begin() == 6);
         
- mytree.rotate(c); // Left rotate
+ bt.rotate(c); // Left rotate
 
     BOOST_CHECK(*c.begin() == 6);
     BOOST_CHECK(*c.parent().begin() == 8);
@@ -53,7 +52,7 @@
     c = c.begin();
     BOOST_CHECK(*c.begin() == 3);
     
- mytree.rotate(c); // Right rotate
+ bt.rotate(c); // Right rotate
     
     BOOST_CHECK(*c.begin() == 3);
     c = c.end();
@@ -81,3 +80,5 @@
 // BOOST_CHECK(*c.parent().parent().end().begin() == 7);
     
 }
+
+BOOST_AUTO_TEST_SUITE_END()

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -8,7 +8,7 @@
 
 #include <vector>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE search_ordered_vector test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -16,7 +16,7 @@
 
 #include <string>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE string_search test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -7,32 +7,66 @@
 #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/tree/cursor.hpp>
 
 #include <list>
 
-// 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])
-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;
+template <class T = int>
+struct test_binary_tree_fixture {
+ test_binary_tree_fixture()
+ {
+ create_test_data_tree(bt);
+ create_test_data_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;
+ }
     
- 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));
-}
+ // 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])
+ void create_test_data_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, 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));
+ }
+
+ boost::tree::binary_tree<T> bt, bt2;
+};
+
+template <class T = int>
+struct test_binary_tree_with_list_fixture
+: public test_binary_tree_fixture<T> {
+ typedef std::back_insert_iterator< std::list<int> > back_insert_iter_list_int;
+ typedef boost::tree::output_cursor_iterator_wrapper<back_insert_iter_list_int> oc_bi_lst_type;
+
+ test_binary_tree_with_list_fixture()
+ : test_binary_tree_fixture<T>(), l(), i(l), o(i) { }
+
+ std::list<int> l;
+ back_insert_iter_list_int i;
+ oc_bi_lst_type o;
+};
 
 template <class Tree>
 void validate_test_data_tree(Tree const& ret)

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -11,7 +11,7 @@
 #include <vector>
 #include <algorithm>
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE treap_tree test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 

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-10-01 18:50:28 EDT (Wed, 01 Oct 2008)
@@ -10,7 +10,7 @@
 
 #include "helpers.hpp"
 
-#define BOOST_TEST_MODULE binary_tree test
+#define BOOST_TEST_MODULE unbalanced_binary_tree test
 //#define BOOST_TEST_DYN_LINK
 #include <boost/test/included/unit_test.hpp>
 


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