Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49096 - in sandbox/SOC/2006/tree/trunk: boost/tree libs/tree/test
From: ockham_at_[hidden]
Date: 2008-10-01 15:38:18


Author: bernhard.reiter
Date: 2008-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
New Revision: 49096
URL: http://svn.boost.org/trac/boost/changeset/49096

Log:
Test cleanup continued.
Removed:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_checks.hpp
Text files modified:
   sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp | 5 --
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_search_test.cpp | 8 +-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/binary_tree_test.cpp | 3
   sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp | 56 ++++++++++++++++++++---
   sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp | 10 +--
   sandbox/SOC/2006/tree/trunk/libs/tree/test/graph_test.cpp | 8 +-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/interval_search_binary_tree_test.cpp | 16 +-----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp | 93 ++++++++++++++++++++++++---------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/key_search_binary_tree_test.cpp | 16 ++----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/multiway_tree_test.cpp | 14 ++---
   sandbox/SOC/2006/tree/trunk/libs/tree/test/nary_tree_test.cpp | 14 +----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/range_helpers_test.cpp | 9 +--
   sandbox/SOC/2006/tree/trunk/libs/tree/test/rank_search_binary_tree_test.cpp | 12 ----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/red_black_tree_test.cpp | 16 ++----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/rotate_binary_tree_test.cpp | 13 +---
   sandbox/SOC/2006/tree/trunk/libs/tree/test/search_ordered_vector_test.cpp | 18 ++-----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/string_search_binary_tree_test.cpp | 8 +-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/treap_test.cpp | 17 ++-----
   sandbox/SOC/2006/tree/trunk/libs/tree/test/unbalanced_binary_tree_test.cpp | 19 +------
   19 files changed, 167 insertions(+), 188 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp (original)
+++ sandbox/SOC/2006/tree/trunk/boost/tree/forest_tree.hpp 2008-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -9,17 +9,12 @@
  * Binary tree based forest implementation
  */
 
-
 #ifndef BOOST_TREE_FOREST_TREE_HPP
 #define BOOST_TREE_FOREST_TREE_HPP
 
-
 #include <boost/tree/detail/cursor/forest.hpp>
 #include <boost/tree/binary_tree.hpp>
 
-#include <boost/test/minimal.hpp>
-
-
 namespace boost {
 namespace tree {
 

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -10,7 +10,9 @@
 #include <boost/tree/iterator.hpp>
 #include <boost/tree/algorithm.hpp>
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 #include <list>
 #include <algorithm>
@@ -31,7 +33,7 @@
     //BOOST_CHECK(inorder::next(c) == d);
 }
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( binary_tree_search_test )
 {
     binary_tree<int> test_tree;
     create_test_data_tree(test_tree);
@@ -62,6 +64,4 @@
     
     *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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -155,8 +155,7 @@
     // test with allocator
 }
 
-//int test_main(int, char* [])
-BOOST_AUTO_TEST_CASE( old_test )
+BOOST_AUTO_TEST_CASE( binary_tree_test )
 {
     typedef binary_tree<int> tree_t;
     tree_t tree1, tree2;

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -4,12 +4,12 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-
 #include <boost/tree/binary_tree.hpp>
-
 #include <boost/tree/iterator.hpp>
 #include <boost/tree/algorithm.hpp>
 
+#include <boost/lambda/bind.hpp>
+
 #include <list>
 #include <algorithm>
 #include <iterator>
@@ -24,17 +24,57 @@
 
 using namespace boost::tree;
 
-// Some macro magic, to save us from all too tedious redundant calls
-// to each of the three types of order algorithms and checks.
+template <class Order, class Cursor, class Container>
+void test_for_each(Order, Cursor c, Container& cont)
+{
+ boost::tree::for_each(
+ Order(),
+ c,
+ boost::lambda::bind(&Container::push_back, &cont, boost::lambda::_1)
+ );
+ test_traversal(Order(), cont.begin(), cont.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());
+}
+
+template <class Order, class Cursor, class OutCursor, class Container>
+void test_transform(Order, 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::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());
+}
 
-#include "subtree_algorithms_checks.hpp"
+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);
+}
 
 typedef boost::mpl::list<preorder,inorder,postorder> orders;
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_algorithms, Order, orders )
 {
- using boost::forward_traversal_tag;
-
     binary_tree<int> test_tree, test_tree2;
     create_test_data_tree(test_tree);
     create_test_data_tree(test_tree2);
@@ -50,5 +90,5 @@
     BOOST_CHECK(test_tree != test_tree2);
     d = test_tree2.root();
 
- test::algorithms(Order(), test_tree.root(), test_tree2.root());
+ algorithms(Order(), test_tree.root(), test_tree2.root());
 }

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -11,12 +11,12 @@
 
 #include <list>
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 #include "test_tree_traversal_data.hpp"
 
-#include "subtree_algorithms_checks.hpp"
-
 //TODO: Make this a test suite.
 
 void test_forest_tree()
@@ -103,10 +103,8 @@
     BOOST_CHECK(test_list.size() == 11);
 }
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( forest_tree_test )
 {
     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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -9,7 +9,9 @@
 #include <boost/graph/depth_first_search.hpp>
 #include <boost/graph/visitors.hpp>
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 #include <list>
 #include <iterator>
@@ -17,7 +19,7 @@
 #include "helpers.hpp"
 #include "test_tree_traversal_data.hpp"
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( graph_test )
 {
     using namespace boost;
     using boost::tree::binary_tree;
@@ -113,6 +115,4 @@
     
     // 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/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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -11,10 +11,9 @@
 //#include <boost/numeric/interval/compare/lexicographic.hpp>
 #include <boost/multi_index/identity.hpp>
 
-
-#include <boost/test/minimal.hpp>
-
-//TODO: Make this a test suite.
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 //TODO: add real tests. (what is where?)
 // test overlaps stuff.
@@ -35,7 +34,7 @@
     }
 };
 
-void test_interval_search_binary_tree()
+BOOST_AUTO_TEST_CASE( interval_search_binary_tree_test )
 {
     using boost::tree::searcher;
     using boost::tree::binary_tree;
@@ -61,10 +60,3 @@
 // BOOST_CHECK(ci == my_tree.end());
     
 }
-
-
-int test_main(int, char* [])
-{
- 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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -4,18 +4,9 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // 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.
-
-// TODO: get timings. that makes that no testcase anymore, right?
-//does boost have timers? what does the austern et al one look like?
-
 #include <boost/tree/binary_tree.hpp>
-
 #include <boost/tree/iterator.hpp>
 #include <boost/tree/algorithm.hpp>
-
 #include <boost/tree/ascending_cursor.hpp>
 #include <boost/tree/root_tracking_cursor.hpp>
 
@@ -32,10 +23,38 @@
 
 using namespace boost::tree;
 
-// Some macro magic, to save us from all too tedious redundant calls
-// to each of the three types of order algorithms and checks.
+template <class Order, class Cursor>
+void compare_cursor_to_iterator_traversal(Order, 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::copy(Order(), cur, oc_test_list);
+
+ // Are the elements accessed in the correct order?
+ BOOST_CHECK(std::equal( boost::tree::begin(Order(), cur),
+ boost::tree::end(Order(), cur),
+ test_list.begin()
+ ));
+
+ // Does end() mark the right element?
+ BOOST_CHECK(std::distance(boost::tree::begin(Order(), cur),
+ boost::tree::end(Order(), cur)) ==
+ std::distance(test_list.begin(), test_list.end()));
+
+ // Reverse order.
+ BOOST_CHECK(std::equal( boost::tree::rbegin(Order(), cur),
+ boost::tree::rend(Order(), cur),
+ test_list.rbegin()
+ ));
+
+ BOOST_CHECK(std::distance(boost::tree::rbegin(Order(), cur),
+ boost::tree::rend(Order(), cur)) ==
+ std::distance(test_list.rbegin(), test_list.rend()));
 
-#include "subtree_algorithms_checks.hpp"
+}
 
 template <class Cursor, class Op>
 void underefed_for_each_recursive(Cursor s, Op& f)
@@ -65,12 +84,12 @@
 
 template <class Order>
 void comparisons_using_ac(binary_tree<int>::cursor c) {
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(c)));
+ compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(c)));
 }
 
 template <class Order>
 void comparisons_using_rtc(binary_tree<int>::cursor c) {
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(c));
+ compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(c));
 }
 
 typedef boost::mpl::list<preorder,inorder,postorder> orders;
@@ -85,54 +104,54 @@
  * "explicit stack"-based cursors also.
  */
 //void compare_cursor_to_iterator_traversal() {
-BOOST_AUTO_TEST_CASE_TEMPLATE( compare_cursor_to_iterator_traversal, Order, orders )
+BOOST_AUTO_TEST_CASE_TEMPLATE( compare_cursor_to_iterator_traversal_test, Order, orders )
 {
     binary_tree<int> test_tree2;
     //test::compare_cursor_to_iterator_traversal(Order(), test_tree2.root());
 
     binary_tree<int>::cursor c = test_tree2.insert(test_tree2.root(), 8);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
 
     c = test_tree2.insert(c, 3);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
         
     test_tree2.insert(c, 1);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     c = test_tree2.insert(++c, 6);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     test_tree2.insert(c, 4);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     test_tree2.insert(++c, 7);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     c = test_tree2.insert(test_tree2.root().end(), 10);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     c = test_tree2.insert(test_tree2.root().end().end(), 14);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     c = test_tree2.insert(c, 13);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     c = test_tree2.insert(c, 11);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     c = test_tree2.insert(++c, 12);
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(test_tree2.root()));
- test::compare_cursor_to_iterator_traversal(Order(), make_root_tracking_cursor(make_ascending_cursor(test_tree2.root())));
+ 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())));
     
     underefed_for_each(test_tree2.root(), comparisons_using_ac<Order>);
     underefed_for_each(test_tree2.root(), comparisons_using_rtc<Order>);

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -4,20 +4,21 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-//#include <boost/test/unit_test.hpp>
-#include <boost/test/minimal.hpp>
-
 #include <boost/tree/binary_tree.hpp>
 #include <boost/tree/balancers/unbalanced.hpp>
 
 #include <boost/tree/searcher.hpp>
 #include <boost/tree/algorithm.hpp>
 
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
+
 #include "helpers.hpp"
 
 //TODO: Make this a test suite.
 
-void test_key_search_binary_tree()
+BOOST_AUTO_TEST_CASE( key_search_binary_tree_test )
 {
     using namespace boost::tree;
     
@@ -181,10 +182,3 @@
 //
 // return key_search_test;
 //}
-
-int test_main(int, char* [])
-{
- test_key_search_binary_tree();
-
- 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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -6,11 +6,13 @@
 
 #include <boost/tree/multiway_tree.hpp>
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 //TODO: Make this a test suite.
 
-void test_multiway_tree()
+BOOST_AUTO_TEST_CASE( multiway_tree_test )
 {
     using namespace boost::tree;
     
@@ -19,10 +21,4 @@
 
     //tree_type::cursor c =
     //mytree.insert(mytree.root(), 3);
-}
-
-int test_main(int, char* [])
-{
- test_multiway_tree();
- return 0;
-}
+}
\ No newline at end of file

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -6,11 +6,11 @@
 
 #include <boost/tree/nary_tree.hpp>
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
-//TODO: Make this a test suite.
-
-void test_nary_tree()
+BOOST_AUTO_TEST_CASE( nary_tree_test )
 {
     using namespace boost::tree;
     
@@ -40,9 +40,3 @@
     BOOST_CHECK(c == c.begin().parent());
 
 }
-
-int test_main(int, char* [])
-{
- 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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -6,12 +6,12 @@
 
 #include <boost/tree/detail/range_helpers.hpp>
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 #include <vector>
 
-//TODO: Make this a test suite.
-
 void test_binary_lower_bound()
 {
     using boost::tree::binary_lower_bound;
@@ -89,12 +89,11 @@
     BOOST_CHECK(ci == vec().end());
 }
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( range_helpers_test )
 {
     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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -4,9 +4,6 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-//#include <boost/test/unit_test.hpp>
-#include <boost/test/minimal.hpp>
-
 #include <boost/tree/binary_tree.hpp>
 #include <boost/tree/balancers/unbalanced.hpp>
 #include <boost/tree/augmentors/rank.hpp>
@@ -19,7 +16,7 @@
 //TODO: Make this a test suite.
 
 
-void test_rank_search_binary_tree()
+BOOST_AUTO_TEST_CASE( rank_search_binary_tree_test )
 {
     using namespace boost::tree;
 //
@@ -55,10 +52,3 @@
 //
 // return rank_search_test;
 //}
-
-int test_main(int, char* [])
-{
- test_rank_search_binary_tree();
-
- 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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -8,20 +8,20 @@
 #include <boost/tree/balancers/red_black.hpp>
 #include <boost/tree/augmentors/unaugmented.hpp>
 
-//#include <boost/tree/searcher.hpp>
-
 #include <vector>
 #include <algorithm>
 
-#include "helpers.hpp"
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
-#include <boost/test/minimal.hpp>
+#include "helpers.hpp"
 
 using boost::tree::binary_tree;
 
 //TODO: Make this a test suite.
 
-void test_red_black_tree()
+BOOST_AUTO_TEST_CASE( red_black_tree_test )
 {
     using namespace boost::tree;
     
@@ -147,9 +147,3 @@
         
 }
 
-
-int test_main(int, char* [])
-{
- 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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -11,13 +11,15 @@
 #include "helpers.hpp"
 #include "test_tree_traversal_data.hpp"
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE 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.
 
-void test_rotate()
+BOOST_AUTO_TEST_CASE( rotate_binary_tree_test )
 {
     binary_tree<int> a;
     binary_tree<int> mytree(a);
@@ -79,10 +81,3 @@
 // BOOST_CHECK(*c.parent().parent().end().begin() == 7);
     
 }
-
-
-int test_main(int, char* [])
-{
- 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-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -4,16 +4,15 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/test/minimal.hpp>
-
 #include <boost/tree/searcher.hpp>
 
 #include <vector>
 
-//TODO: Make this a test suite.
-
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
-static void search_ordered_vector_test()
+BOOST_AUTO_TEST_CASE( search_ordered_vector_test )
 {
 // using boost::tree::searcher;
 // using std::vector;
@@ -47,11 +46,4 @@
 // ordered_vector_test->add( BOOST_TEST_CASE( &search_ordered_vector_test ) );
 //
 // return ordered_vector_test;
-//}
-
-
-int test_main(int, char* [])
-{
- search_ordered_vector_test();
- return 0;
-}
+//}
\ No newline at end of file

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -16,9 +16,9 @@
 
 #include <string>
 
-#include <boost/test/minimal.hpp>
-
-//TODO: Make this a test suite.
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 //Words from Austern et al., p1290
 
@@ -77,7 +77,7 @@
 }
 
 
-int test_main(int, char* [])
+BOOST_AUTO_TEST_CASE( string_search_binary_tree_test )
 {
     test_normal_string_search_binary_tree();
     test_optimized_string_search_binary_tree();

Deleted: sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_checks.hpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_checks.hpp 2008-10-01 15:38:16 EDT (Wed, 01 Oct 2008)
+++ (empty file)
@@ -1,103 +0,0 @@
-// Copyright (c) 2006-2008, Bernhard Reiter
-//
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#include <boost/tree/algorithm.hpp>
-#include <boost/tree/binary_tree.hpp>
-
-#include <boost/lambda/bind.hpp>
-
-#include <list>
-#include <algorithm>
-#include <iterator>
-
-#include "helpers.hpp"
-#include "test_tree_traversal_data.hpp"
-
-using namespace boost::tree;
-
-namespace test {
-
-template <class Order, class Cursor, class Container>
-void test_for_each(Order, Cursor c, Container& cont)
-{
- boost::tree::for_each(
- Order(),
- c,
- boost::lambda::bind(&Container::push_back, &cont, boost::lambda::_1)
- );
- test_traversal(Order(), cont.begin(), cont.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());
-}
-
-template <class Order, class Cursor, class OutCursor, class Container>
-void test_transform(Order, 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::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);
-}
-
-template <class Order, class Cursor>
-void compare_cursor_to_iterator_traversal(Order, 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::copy(Order(), cur, oc_test_list);
-
- // Are the elements accessed in the correct order?
- BOOST_CHECK(std::equal( boost::tree::begin(Order(), cur),
- boost::tree::end(Order(), cur),
- test_list.begin()
- ));
-
- // Does end() mark the right element?
- BOOST_CHECK(std::distance(boost::tree::begin(Order(), cur),
- boost::tree::end(Order(), cur)) ==
- std::distance(test_list.begin(), test_list.end()));
-
- // Reverse order.
- BOOST_CHECK(std::equal( boost::tree::rbegin(Order(), cur),
- boost::tree::rend(Order(), cur),
- test_list.rbegin()
- ));
-
- BOOST_CHECK(std::distance(boost::tree::rbegin(Order(), cur),
- boost::tree::rend(Order(), cur)) ==
- std::distance(test_list.rbegin(), test_list.rend()));
-
-}
-
-} // namespace test

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -8,18 +8,18 @@
 #include <boost/tree/balancers/treap.hpp>
 #include <boost/tree/augmentors/unaugmented.hpp>
 
-//#include <boost/tree/searcher.hpp>
-
 #include <vector>
 #include <algorithm>
 
-#include <boost/test/minimal.hpp>
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
 #include "helpers.hpp"
 
 //TODO: Make this a test suite.
 
-void test_treap()
+BOOST_AUTO_TEST_CASE( treap_test )
 {
     using namespace boost::tree;
     
@@ -55,11 +55,4 @@
     //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;
-}
+}
\ No newline at end of file

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 15:38:16 EDT (Wed, 01 Oct 2008)
@@ -4,21 +4,17 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/test/minimal.hpp>
-
 #include <boost/tree/balanced_tree.hpp>
 #include <boost/tree/detail/balancers/unbalanced.hpp>
 #include <boost/tree/binary_tree.hpp>
 
-//#include <boost/tree/searcher.hpp>
-//#include <boost/tree/algorithm.hpp>
-
 #include "helpers.hpp"
 
-//TODO: Make this a test suite.
+#define BOOST_TEST_MODULE binary_tree test
+//#define BOOST_TEST_DYN_LINK
+#include <boost/test/included/unit_test.hpp>
 
-
-void test_unbalanced_binary_tree()
+BOOST_AUTO_TEST_CASE( unbalanced_binary_tree_test )
 {
     using namespace boost::tree;
     
@@ -81,10 +77,3 @@
 //
 // return key_search_test;
 //}
-
-int test_main(int, char* [])
-{
- test_unbalanced_binary_tree();
-
- 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