From 85e0e920bfa27d88bd7339ed8a161e5daf1de579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Br=C3=B6nnimann?= Date: Fri, 23 Jul 2004 16:13:43 +0000 Subject: [PATCH] Removed char* name and dependence on iostream, not appropriate for test suite (relic of example and debugging). [SVN r23996] --- minmax/test/minmax_element_test.cpp | 35 ++++++++--------------------- minmax/test/minmax_test.cpp | 6 ++--- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/minmax/test/minmax_element_test.cpp b/minmax/test/minmax_element_test.cpp index 9fe0649..9ea4e13 100644 --- a/minmax/test/minmax_element_test.cpp +++ b/minmax/test/minmax_element_test.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include @@ -16,7 +15,6 @@ class custom { int m_x; friend bool operator<(custom const& x, custom const& y); - friend std::ostream& operator<<(std::ostream& str, custom const& x); public: explicit custom(int x = 0) : m_x(x) {} custom(custom const& y) : m_x(y.m_x) {} @@ -29,12 +27,6 @@ bool operator< (custom const& x, custom const& y) return x.m_x < y.m_x; } -std::ostream& operator<<(std::ostream& str, custom const& x) -{ - str << x.m_x; - return str; -} - BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(custom) namespace std { @@ -189,49 +181,40 @@ void test_container(Iterator first, Iterator last, int n, Container* dummy = 0 ) } template -void test_range(Iterator first, Iterator last, int n, char* /* name */) +void test_range(Iterator first, Iterator last, int n) { typedef typename std::iterator_traits::value_type Value; // Test various containers with these values - // std::cout << " vector<" << name << ">..."; test_container< std::vector, Iterator, Value >(first, last, n); - // std::cout << " list<" << name << ">..."; test_container< std::list, Iterator, Value >(first, last, n); - // std::cout << " set<" << name << ">..."; test_container< std::set, Iterator, Value >(first, last, n); - // std::cout << "\n"; } template -void test(int n, char* name) +void test(int n) { // Populate test vector with identical values - // std::cout << " Identical values... "; std::vector test_vector(n, Value(1)); typename std::vector::iterator first( test_vector.begin() ); typename std::vector::iterator last( test_vector.end() ); - test_range(first, last, n, name); + test_range(first, last, n); // Populate test vector with two values - // std::cout << " Two distinct values..."; typename std::vector::iterator middle( first + n/2 ); std::fill(middle, last, Value(2)); - test_range(first, last, n, name); + test_range(first, last, n); // Populate test vector with increasing values - // std::cout << " Increasing values... "; std::accumulate(first, last, Value(0)); - test_range(first, last, n, name); + test_range(first, last, n); // Populate test vector with decreasing values - // std::cout << " Decreasing values... "; std::reverse(first, last); - test_range(first, last, n, name); + test_range(first, last, n); // Populate test vector with random values - // std::cout << " Random values... "; std::random_shuffle(first, last); - test_range(first, last, n, name); + test_range(first, last, n); } int test_main( int argc, char* argv[] ) @@ -239,8 +222,8 @@ int test_main( int argc, char* argv[] ) int n = 100; if (argc > 1) n = atoi(argv[1]); - test(n, "builtin"); - test(n, "custom "); + test(n); + test(n); return 0; } diff --git a/minmax/test/minmax_test.cpp b/minmax/test/minmax_test.cpp index 972c459..0784950 100644 --- a/minmax/test/minmax_test.cpp +++ b/minmax/test/minmax_test.cpp @@ -40,7 +40,7 @@ private: }; template -void test(char*) +void test() { using namespace boost; Value zero(0), one(1); @@ -72,8 +72,8 @@ void test(char*) int test_main( int , char* [] ) { - test("builtin"); - test("custom "); + test(); // ("builtin"); + test(); // ("custom "); return 0; }