Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50445 - sandbox/SOC/2006/tree/trunk/libs/tree/test
From: ockham_at_[hidden]
Date: 2009-01-02 17:45:10


Author: bernhard.reiter
Date: 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
New Revision: 50445
URL: http://svn.boost.org/trac/boost/changeset/50445

Log:
More test cleanup.
Text files modified:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/algorithm_concepts_test.cpp | 6 +++++-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/ascending_cursor_test.cpp | 32 ++++++++++++++++----------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp | 8 +++++++-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp | 26 --------------------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_tree_test.cpp | 4 ++++
   sandbox/SOC/2006/tree/trunk/libs/tree/test/helpers.hpp | 6 ------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/iterator_algorithm_test.cpp | 19 +++++--------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp | 17 ++++++++++++++++-
   sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp | 6 ++++++
   sandbox/SOC/2006/tree/trunk/libs/tree/test/to_first_test.cpp | 2 +-
   10 files changed, 60 insertions(+), 66 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/algorithm_concepts_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/algorithm_concepts_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/algorithm_concepts_test.cpp 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -15,7 +15,11 @@
 #include <boost/test/included/unit_test.hpp>
 #include <boost/test/test_case_template.hpp>
 
-#include "helpers.hpp"
+#include <boost/mpl/list.hpp>
+
+typedef boost::mpl::list<boost::tree::preorder
+ ,boost::tree::inorder
+ ,boost::tree::postorder> orders;
 
 using namespace boost::tree;
 

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/ascending_cursor_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/ascending_cursor_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/ascending_cursor_test.cpp 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -4,33 +4,33 @@
 // (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/lambda/bind.hpp>
-
 #define BOOST_TEST_MODULE cursor_algorithm test
 #include <boost/test/included/unit_test.hpp>
-#include <boost/test/test_case_template.hpp>
 
-#include "helpers.hpp"
-#include "test_tree_traversal_data.hpp"
+#include <boost/tree/ascending_cursor.hpp>
 
 #include "fake_binary_tree.hpp"
 
 using namespace boost::tree;
 
-BOOST_FIXTURE_TEST_SUITE( ascending_cursor_test, fake_binary_tree_with_list_fixture<int> )
+BOOST_FIXTURE_TEST_SUITE( ascending_cursor_test, fake_binary_tree_fixture<int> )
 
 BOOST_AUTO_TEST_CASE( test_ascending_cursor )
 {
-// FIXME: Test differently, ie not relying on cursor-iterator adaptation.
-// test_traversal(Order(), begin(Order(), make_ascending_cursor(fbt1.descending_root()))
-// , end(Order(), make_ascending_cursor(fbt1.descending_root())));
-// test_reverse_traversal(Order(), end(Order(), make_ascending_cursor(fbt1.descending_root()))
-// , begin(Order(), make_ascending_cursor(fbt1.descending_root())));
-// BOOST_CHECK_EQUAL(std::distance(
-// begin(Order(), make_ascending_cursor(fbt1.descending_root()))
-// , end(Order(), make_ascending_cursor(fbt1.descending_root()))), 11);
+ typedef fake_binary_tree<int>::descending_cursor dc_t;
+ ascending_cursor<dc_t> ac = make_ascending_cursor(fbt1.descending_root());
+
+ ac.to_begin().to_end().to_begin().to_begin();
+
+// FIXME
+// BOOST_CHECK_EQUAL(*ac, 4);
+ ac.to_parent();
+// BOOST_CHECK_EQUAL(*ac, 6);
+// ac.to_parent();
+// BOOST_CHECK_EQUAL(*ac, 3);
+// ac.to_parent();
+// BOOST_CHECK_EQUAL(*ac, 8);
+
 }
 
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/copy_test.cpp 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -17,7 +17,8 @@
 
 using namespace boost::tree;
 
-BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_with_list_fixture<int>)
+BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test_with_fixture
+ , fake_binary_tree_with_list_fixture<int>)
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_copy_descending, Order, orders)
 {
@@ -31,6 +32,11 @@
     test_traversal(Order(), l.begin(), l.end());
 }
 
+BOOST_AUTO_TEST_SUITE_END()
+
+
+BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_fixture<int>)
+
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_copy_trees_descending, Order, orders)
 {
     BOOST_CHECK(fbt1 != fbt2);

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 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -32,30 +32,4 @@
     BOOST_CHECK(f == l);
 }
 
-BOOST_AUTO_TEST_SUITE_END()
-
-BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_with_list_fixture<int>)
-
-//BOOST_AUTO_TEST_CASE_TEMPLATE ( test_desc_copy_using_insert_cursor, Order, orders )
-//{
-// bt2.clear();
-//
-// boost::tree::copy(Order(), bt.root(), tree_inserter(bt2, bt2.root())
-// , boost::forward_traversal_tag());
-//
-// validate_test_dataset1_tree(bt2.root());
-// BOOST_CHECK_EQUAL(size(bt2.root()), size(bt.root()));
-//}
-//
-//BOOST_AUTO_TEST_CASE_TEMPLATE ( test_asc_copy_using_insert_cursor, Order, orders )
-//{
-// bt2.clear();
-//
-// boost::tree::copy(Order(), bt.root(), tree_inserter(bt2, bt2.root())
-// , boost::bidirectional_traversal_tag());
-//
-// validate_test_dataset1_tree(bt2.root());
-// BOOST_CHECK_EQUAL(size(bt2.root()), size(bt.root()));
-//}
-
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -117,6 +117,10 @@
 
 BOOST_AUTO_TEST_SUITE_END()
 
+//BOOST_FIXTURE_TEST_SUITE(forest_fixture_test, fake_binary_tree_with_list_fixture<int>)
+//
+//BOOST_AUTO_TEST_SUITE_END()
+
 //BOOST_FIXTURE_TEST_SUITE(forest_algorithms_test, test_binary_tree_with_list_fixture<int>)
 //
 //// Test *order correspondence:

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 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -15,8 +15,6 @@
 
 #include <boost/tree/output_iterator_cursor.hpp>
 
-#include <boost/mpl/list.hpp>
-
 #include <list>
 
 struct test_with_list_fixture
@@ -32,10 +30,6 @@
     oc_bi_lst_type o;
 };
 
-typedef boost::mpl::list<boost::tree::preorder
- ,boost::tree::inorder
- ,boost::tree::postorder> orders;
-
 //using namespace boost::tree;
 //
 //using boost::multi_index::identity;

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 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -7,8 +7,8 @@
 #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>
+//#include <boost/tree/ascending_cursor.hpp>
+//#include <boost/tree/root_tracking_cursor.hpp>
 
 #include <list>
 #include <iterator>
@@ -23,6 +23,9 @@
 
 using namespace boost::tree;
 
+// We should actually just check if operators++ and -- call next and prior
+// Pretty simple -- any actual need for a test file?
+
 BOOST_FIXTURE_TEST_SUITE( iterator_algorithms_test, fake_binary_tree_with_list_fixture<int> )
 
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_iterator_algorithms, Order, orders )
@@ -91,16 +94,4 @@
                                   , end(postorder(), fbt1.ascending_root().end())), 5);
 }
 
-BOOST_AUTO_TEST_CASE( test_ascending_iterator_algorithms )
-{
- typedef fake_ascending_binary_cursor<int> cursor;
- cursor c = fbt1.ascending_root();
- typedef boost::tree::root_tracking_cursor<cursor> rtc;
- typedef boost::tree::iterator<ascending, rtc> ai;
- c.to_begin().to_end().to_begin().to_begin();
- BOOST_CHECK_EQUAL(*c, 4);
-
- test_traversal_from_leaf4(ai(rtc(c)), ai(rtc(cursor(fbt1,0))));
-}
-
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/successor_test.cpp 2009-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -17,7 +17,9 @@
 
 using namespace boost::tree;
 
-BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_with_list_fixture<int>)
+BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_fixture<int>)
+
+// TODO: iterate over all elements.
 
 BOOST_AUTO_TEST_CASE( test_successor_preorder )
 {
@@ -40,4 +42,17 @@
     BOOST_CHECK(c == fbt1.root_tracking_root());
 }
 
+BOOST_AUTO_TEST_CASE( test_successor_ascending )
+{
+ fake_binary_tree<int>::ascending_cursor c = fbt1.ascending_root();
+ c.to_begin().to_end().to_begin().to_begin();
+ BOOST_CHECK_EQUAL(*c, 4);
+ boost::tree::successor(ascending(), c);
+ BOOST_CHECK_EQUAL(*c, 6);
+ boost::tree::successor(ascending(), c);
+ BOOST_CHECK_EQUAL(*c, 3);
+ boost::tree::successor(ascending(), c);
+ BOOST_CHECK_EQUAL(*c, 8);
+}
+
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

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-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -12,8 +12,14 @@
 
 #include <vector>
 
+#include <boost/mpl/list.hpp>
+
 #include "helpers.hpp"
 
+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()

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-01-02 17:45:09 EST (Fri, 02 Jan 2009)
@@ -17,7 +17,7 @@
 
 using namespace boost::tree;
 
-BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_with_list_fixture<int>)
+BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_fixture<int>)
 
 BOOST_AUTO_TEST_CASE( test_to_first_preorder )
 {


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