|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51549 - sandbox/SOC/2006/tree/trunk/libs/tree/test
From: ockham_at_[hidden]
Date: 2009-03-02 21:26:44
Author: bernhard.reiter
Date: 2009-03-02 21:26:43 EST (Mon, 02 Mar 2009)
New Revision: 51549
URL: http://svn.boost.org/trac/boost/changeset/51549
Log:
Move forest test helpers to forest_test.cpp
Text files modified:
sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_test.cpp | 61 ++++++++++++++++++++++++++++++++++++++++
sandbox/SOC/2006/tree/trunk/libs/tree/test/test_tree_traversal_data.hpp | 61 ----------------------------------------
2 files changed, 61 insertions(+), 61 deletions(-)
Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_test.cpp
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_test.cpp (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/forest_test.cpp 2009-03-02 21:26:43 EST (Mon, 02 Mar 2009)
@@ -24,6 +24,67 @@
using namespace boost::tree;
+template <class Forest>
+static void create_test_dataset1_forest(Forest& f)
+{
+ // For augmented trees. (Why is this necessary? Nothing here is explicit!)
+ typedef typename Forest::value_type value_type;
+
+ typename Forest::cursor cur = f.insert(f.end(), value_type(8));
+ cur = f.insert(f.end(), value_type(10));
+ cur = f.insert(f.end(), value_type(14));
+
+ cur = f.begin().begin();
+ cur = f.insert(cur, value_type(3));
+ cur = f.insert(++cur, value_type(7));
+ cur = f.insert(cur, value_type(6));
+
+ cur = f.begin().begin().begin();
+ cur = f.insert(cur, value_type(1));
+
+ cur = f.begin().begin();
+ cur = f.insert((++cur).to_begin(), value_type(4));
+
+ cur = f.begin();
+ cur = f.insert((++++cur).to_begin(), value_type(13));
+ cur = f.insert(cur.to_begin(), value_type(11));
+ cur = f.insert(++cur, value_type(12));
+}
+
+template <class Cursor>
+static void validate_test_dataset1_forest(Cursor cur, Cursor e)
+{
+ Cursor c = cur;
+ BOOST_CHECK_EQUAL(*c, 8);
+ BOOST_CHECK_EQUAL(*c.to_begin(), 3);
+ BOOST_CHECK_EQUAL(*++c, 6);
+ BOOST_CHECK_EQUAL(*++c, 7);
+ BOOST_CHECK(++c == cur.end());
+
+ c = cur.begin();
+ BOOST_CHECK_EQUAL(*c.to_begin(), 1);
+ BOOST_CHECK(++c == cur.begin().end());
+
+ c = cur.begin();
+ ++c;
+ Cursor d = c;
+ BOOST_CHECK_EQUAL(*c.to_begin(), 4);
+ BOOST_CHECK(++c == d.end());
+
+ c = cur;
+ BOOST_CHECK_EQUAL(*++c, 10);
+ BOOST_CHECK_EQUAL(*++c, 14);
+ d = c;
+ BOOST_CHECK(++c == e);
+ c = d;
+ BOOST_CHECK_EQUAL(*c.to_begin(), 13);
+ BOOST_CHECK(++c == d.end());
+ c = d.to_begin();
+ BOOST_CHECK_EQUAL(*c.to_begin(), 11);
+ BOOST_CHECK_EQUAL(*++c, 12);
+ BOOST_CHECK(++c == d.end());
+}
+
BOOST_AUTO_TEST_SUITE( basic_forest_test )
BOOST_AUTO_TEST_CASE( constructors_test )
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-03-02 21:26:43 EST (Mon, 02 Mar 2009)
@@ -101,67 +101,6 @@
boost::tree::binary_tree<T> bt, bt2;
};
-template <class Forest>
-static void create_test_dataset1_forest(Forest& f)
-{
- // For augmented trees. (Why is this necessary? Nothing here is explicit!)
- typedef typename Forest::value_type value_type;
-
- typename Forest::cursor cur = f.insert(f.end(), value_type(8));
- cur = f.insert(f.end(), value_type(10));
- cur = f.insert(f.end(), value_type(14));
-
- cur = f.begin().begin();
- cur = f.insert(cur, value_type(3));
- cur = f.insert(++cur, value_type(7));
- cur = f.insert(cur, value_type(6));
-
- cur = f.begin().begin().begin();
- cur = f.insert(cur, value_type(1));
-
- cur = f.begin().begin();
- cur = f.insert((++cur).to_begin(), value_type(4));
-
- cur = f.begin();
- cur = f.insert((++++cur).to_begin(), value_type(13));
- cur = f.insert(cur.to_begin(), value_type(11));
- cur = f.insert(++cur, value_type(12));
-}
-
-template <class Cursor>
-static void validate_test_dataset1_forest(Cursor cur, Cursor e)
-{
- Cursor c = cur;
- BOOST_CHECK_EQUAL(*c, 8);
- BOOST_CHECK_EQUAL(*c.to_begin(), 3);
- BOOST_CHECK_EQUAL(*++c, 6);
- BOOST_CHECK_EQUAL(*++c, 7);
- BOOST_CHECK(++c == cur.end());
-
- c = cur.begin();
- BOOST_CHECK_EQUAL(*c.to_begin(), 1);
- BOOST_CHECK(++c == cur.begin().end());
-
- c = cur.begin();
- ++c;
- Cursor d = c;
- BOOST_CHECK_EQUAL(*c.to_begin(), 4);
- BOOST_CHECK(++c == d.end());
-
- c = cur;
- BOOST_CHECK_EQUAL(*++c, 10);
- BOOST_CHECK_EQUAL(*++c, 14);
- d = c;
- BOOST_CHECK(++c == e);
- c = d;
- BOOST_CHECK_EQUAL(*c.to_begin(), 13);
- BOOST_CHECK(++c == d.end());
- c = d.to_begin();
- BOOST_CHECK_EQUAL(*c.to_begin(), 11);
- BOOST_CHECK_EQUAL(*++c, 12);
- BOOST_CHECK(++c == d.end());
-}
-
template <class Container>
void generate_mock_cursor_data(boost::tree::preorder, Container& data)
{
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