Boost logo

Boost-Commit :

From: ockham_at_[hidden]
Date: 2008-03-25 12:10:44


Author: bernhard.reiter
Date: 2008-03-25 12:10:44 EDT (Tue, 25 Mar 2008)
New Revision: 43858
URL: http://svn.boost.org/trac/boost/changeset/43858

Log:
Add subtree_algorithms_test.cpp (which had gone lost previously. Oops!)
Added:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_test.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2006/tree/trunk/libs/tree/test/Jamfile.v2 | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Modified: sandbox/SOC/2006/tree/trunk/libs/tree/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2006/tree/trunk/libs/tree/test/Jamfile.v2 (original)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/Jamfile.v2 2008-03-25 12:10:44 EDT (Tue, 25 Mar 2008)
@@ -23,7 +23,7 @@
         [ run key_search_binary_tree_test.cpp ]
         [ run rank_search_binary_tree_test.cpp ]
         [ run traverse_binary_tree_test.cpp ]
-# [ run subtree_algorithms_test.cpp ]
+ [ run subtree_algorithms_test.cpp ]
         [ run rotate_binary_tree_test.cpp ]
         [ run string_search_binary_tree_test.cpp ]
 

Added: sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2006/tree/trunk/libs/tree/test/subtree_algorithms_test.cpp 2008-03-25 12:10:44 EDT (Tue, 25 Mar 2008)
@@ -0,0 +1,67 @@
+// Copyright (c) 2006, 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)
+
+//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/traversal.hpp>
+
+#include <boost/test/minimal.hpp>
+
+#include <list>
+#include <algorithm>
+#include <iterator>
+
+#include "helpers.hpp"
+#include "test_tree_traversal_data.hpp"
+
+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.
+
+#define ORDER preorder
+#include "subtree_algorithms_checks.hpp"
+
+#undef ORDER
+#define ORDER inorder
+#include "subtree_algorithms_checks.hpp"
+
+#undef ORDER
+#define ORDER postorder
+#include "subtree_algorithms_checks.hpp"
+
+#undef ORDER
+
+int test_main(int, char* [])
+{
+ using boost::forward_traversal_tag;
+
+ binary_tree<int> test_tree, test_tree2;
+ create_test_data_tree(test_tree);
+ create_test_data_tree(test_tree2);
+// BOOST_CHECK(test_tree == test_tree2);
+
+ binary_tree<int>::cursor c = test_tree.root();
+ binary_tree<int>::cursor d = test_tree2.root();
+
+ d = d.begin().end().begin().begin();
+ *d = 29;
+ d = test_tree2.root();
+
+ test::preorder::algorithms (test_tree.root(), test_tree2.root());
+ test::inorder::algorithms (test_tree.root(), test_tree2.root());
+ test::postorder::algorithms(test_tree.root(), test_tree2.root());
+
+ 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