Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52223 - sandbox/SOC/2006/tree/trunk/libs/tree/test
From: ockham_at_[hidden]
Date: 2009-04-06 18:03:49


Author: bernhard.reiter
Date: 2009-04-06 18:03:48 EDT (Mon, 06 Apr 2009)
New Revision: 52223
URL: http://svn.boost.org/trac/boost/changeset/52223

Log:
More test data redundancy reduction.
Text files modified:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/to_first_test.cpp | 25 +++++++++----------------
   sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp | 28 ++++++++++------------------
   2 files changed, 19 insertions(+), 34 deletions(-)

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-04-06 18:03:48 EDT (Mon, 06 Apr 2009)
@@ -11,30 +11,23 @@
 #include <boost/test/test_case_template.hpp>
 
 #include "fake_binary_tree.hpp"
+#include "test_tree_traversal_data.hpp"
 
 using namespace boost::tree;
 
 BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_fixture<int>)
 
-BOOST_AUTO_TEST_CASE( test_to_first_preorder )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_to_first, Order, orders )
 {
- fake_binary_tree<int>::descending_cursor c = fbt1.descending_root();
- boost::tree::to_first(preorder(), c);
- BOOST_CHECK_EQUAL(*c, 8);
-}
+ test_data_set mpo;
+ mock_cursor_data(mpo);
 
-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 )
-{
+ typename test_data_set::index<Order>::type::const_iterator ci
+ = mpo.get<Order>().begin();
+
     fake_binary_tree<int>::descending_cursor c = fbt1.descending_root();
- boost::tree::to_first(postorder(), c);
- BOOST_CHECK_EQUAL(*c, 1);
+ boost::tree::to_first(Order(), c);
+ BOOST_CHECK_EQUAL(*c, ci->val);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/to_last_test.cpp 2009-04-06 18:03:48 EDT (Mon, 06 Apr 2009)
@@ -11,33 +11,25 @@
 #include <boost/test/test_case_template.hpp>
 
 #include "fake_binary_tree.hpp"
+#include "test_tree_traversal_data.hpp"
 
 using namespace boost::tree;
 
 BOOST_FIXTURE_TEST_SUITE(cursor_algorithms_test, fake_binary_tree_fixture<int>)
 
-BOOST_AUTO_TEST_CASE( test_to_last_preorder )
+BOOST_AUTO_TEST_CASE_TEMPLATE( test_to_last, Order, orders )
 {
- fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
- boost::tree::to_last(preorder(), c);
- boost::tree::predecessor(preorder(), c);
- BOOST_CHECK_EQUAL(*c, 12);
-}
+ test_data_set mpo;
+ mock_cursor_data(mpo);
 
-BOOST_AUTO_TEST_CASE( test_to_last_inorder )
-{
- fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
- boost::tree::to_last(inorder(), c);
- boost::tree::predecessor(inorder(), c);
- BOOST_CHECK_EQUAL(*c, 14);
-}
+ typename test_data_set::index<Order>::type::const_iterator cie
+ = mpo.get<Order>().end();
+ --cie;
 
-BOOST_AUTO_TEST_CASE( test_to_last_postorder )
-{
     fake_binary_tree<int>::root_tracking_cursor c = fbt1.root_tracking_root();
- boost::tree::to_last(postorder(), c);
- boost::tree::predecessor(postorder(), c);
- BOOST_CHECK_EQUAL(*c, 8);
+ boost::tree::to_last(Order(), c);
+ boost::tree::predecessor(Order(), c);
+ BOOST_CHECK_EQUAL(*c, cie->val);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file


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