Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50428 - sandbox/SOC/2006/tree/trunk/libs/tree/test
From: ockham_at_[hidden]
Date: 2009-01-01 07:28:30


Author: bernhard.reiter
Date: 2009-01-01 07:28:30 EST (Thu, 01 Jan 2009)
New Revision: 50428
URL: http://svn.boost.org/trac/boost/changeset/50428

Log:
Add tests for to_first().
Text files modified:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/cursor_algorithm_test.cpp | 46 ++++++++++++++++++++++++++++++++++++++++
   1 files changed, 46 insertions(+), 0 deletions(-)

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-01 07:28:30 EST (Thu, 01 Jan 2009)
@@ -21,6 +21,52 @@
 
 BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_with_list_fixture<int>)
 
+BOOST_AUTO_TEST_CASE( test_to_first_preorder )
+{
+ fake_binary_tree<int>::descending_cursor c = fbt1.descending_root();
+ boost::tree::to_first(preorder(), c);
+ BOOST_CHECK_EQUAL(*c, 8);
+}
+
+BOOST_AUTO_TEST_CASE( test_to_first_inorder )
+{
+ fake_binary_tree<int>::descending_cursor c = fbt1.descending_root();
+ boost::tree::to_first(inorder(), c);
+ BOOST_CHECK_EQUAL(*c, 1);
+}
+
+BOOST_AUTO_TEST_CASE( test_to_first_postorder )
+{
+ fake_binary_tree<int>::descending_cursor c = fbt1.descending_root();
+ boost::tree::to_first(postorder(), c);
+ BOOST_CHECK_EQUAL(*c, 1);
+}
+
+// The following require RootTracker.
+
+//BOOST_AUTO_TEST_CASE( test_successor_preorder )
+//{
+// fake_binary_tree<int>::ascending_cursor c = fbt1.ascending_root().begin();
+// boost::tree::successor(preorder(), c);
+// BOOST_CHECK_EQUAL(*c, 3);
+//}
+//
+//BOOST_AUTO_TEST_CASE( test_successor_inorder )
+//{
+// fake_binary_tree<int>::ascending_cursor c = fbt1.ascending_root().begin();
+// boost::tree::successor(inorder(), c);
+// BOOST_CHECK_EQUAL(*c, 10);
+//}
+//
+//BOOST_AUTO_TEST_CASE( test_successor_postorder )
+//{
+// fake_binary_tree<int>::ascending_cursor c = fbt1.ascending_root().begin();
+// boost::tree::successor(postorder(), c);
+// BOOST_CHECK(c == fbt1.ascending_root());
+//}
+
+// Also add tests for predecessor!
+
 BOOST_AUTO_TEST_CASE_TEMPLATE( test_foreach_descending, Order, orders)
 {
     boost::tree::for_each(


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