|
Boost-Commit : |
From: jefffaust_at_[hidden]
Date: 2007-05-27 20:59:00
Author: jefffaust
Date: 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
New Revision: 4327
URL: http://svn.boost.org/trac/boost/changeset/4327
Log:
enable streaming iterator tests
Text files modified:
sandbox/explore/libs/explore/test/boost_array.cpp | 61 +++++++++++++-------------------
sandbox/explore/libs/explore/test/custom_format_simple.cpp | 28 ++++----------
sandbox/explore/libs/explore/test/html_table_output.cpp | 41 ++++++++++++++++++++-
sandbox/explore/libs/explore/test/std_deque.cpp | 46 +++++++++---------------
sandbox/explore/libs/explore/test/std_list.cpp | 46 +++++++++---------------
sandbox/explore/libs/explore/test/std_map.cpp | 69 ++++++++++++++----------------------
sandbox/explore/libs/explore/test/std_set.cpp | 69 ++++++++++++++----------------------
sandbox/explore/libs/explore/test/std_vector.cpp | 74 +++++++++++++++++----------------------
8 files changed, 194 insertions(+), 240 deletions(-)
Modified: sandbox/explore/libs/explore/test/boost_array.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_array.cpp (original)
+++ sandbox/explore/libs/explore/test/boost_array.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -34,16 +34,16 @@
boost::array<int,3> ai3 = {1, 2, 3};
explore::print(ai3, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
+
str_out.str("");
-
- boost::array<int,3>::iterator itr = ai3.begin() + 2;
-
+
+ boost::array<int,3>::iterator itr = ai3.begin() + 2;
+
explore::print(ai3.begin(), itr, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(ai3.begin(), itr), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
}
@@ -67,18 +67,13 @@
boost::array<int,3> ai3 = {1, 2, 3};
str_out << ai3;
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- //str_out.str("");
-
- //boost::array<int,3>::iterator itr = ai3.begin() + 2;
-
- //explore::print(ai3.begin(), itr, str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(ai3.begin(), itr, str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+
+ str_out.str("");
+
+ boost::array<int,3>::iterator itr = ai3.begin() + 2;
+
+ str_out << explore::make_iterator_range(ai3.begin(), itr);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
}
BOOST_AUTO_TEST_CASE( vector_in_array_print_test )
@@ -105,16 +100,16 @@
boost::array<std::vector<int>,3> av3 = {vi, vi, vi};
explore::print(av3, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
- boost::array<std::vector<int>,3>::iterator itr = av3.begin() + 2;
-
+
+ boost::array<std::vector<int>,3>::iterator itr = av3.begin() + 2;
+
explore::print(av3.begin(), itr, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(av3.begin(), itr), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
@@ -143,16 +138,10 @@
boost::array<std::vector<int>,3> av3 = {vi, vi, vi};
str_out << av3;
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //boost::array<std::vector<int>,3> itr = av3.begin() + 2;
-
- //explore::print(av3.begin(), itr, str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(av3.begin(), itr), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+
+ str_out.str("");
+
+ boost::array<std::vector<int>,3>::iterator itr = av3.begin() + 2;
+ str_out << explore::make_iterator_range(av3.begin(), itr);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
Modified: sandbox/explore/libs/explore/test/custom_format_simple.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/custom_format_simple.cpp (original)
+++ sandbox/explore/libs/explore/test/custom_format_simple.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -76,20 +76,15 @@
str_out << vi;
BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
- //str_out.str("");
-
- //explore::print(vi.begin(), ++(++vi.begin()), str_out, basic_lg_format(), explore::default_container_policy());
- //BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
-
- //str_out.str("");
+ str_out.str("");
- //explore::print(boost::make_iterator_range(vi.begin(), ++(++vi.begin())), str_out, basic_lg_format(), explore::default_container_policy());
- //BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
+ str_out << explore::make_iterator_range(vi.begin(), ++(++vi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
- //str_out.str("");
+ str_out.str("");
- //explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
- //BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
}
BOOST_AUTO_TEST_CASE( basic_map_custom_format_print_test )
@@ -147,13 +142,8 @@
str_out << mis;
BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>#<=3#third=>=>");
- //str_out.str("");
-
- //explore::print(mis.begin(), ++(++mis.begin()), str_out, basic_lg_format(), explore::default_container_policy());
- //BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>=>");
-
- //str_out.str("");
+ str_out.str("");
- //explore::print(boost::make_iterator_range(mis.begin(), ++(++mis.begin())), str_out, basic_lg_format(), explore::default_container_policy());
- //BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>=>");
+ str_out << explore::make_iterator_range(mis.begin(), ++(++mis.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>=>");
}
Modified: sandbox/explore/libs/explore/test/html_table_output.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/html_table_output.cpp (original)
+++ sandbox/explore/libs/explore/test/html_table_output.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -16,8 +16,7 @@
#include "../../../boost/explore/html_table_format.hpp"
#include "../../../boost/explore/stream_container.hpp"
-
-BOOST_AUTO_TEST_CASE( vector_in_c_array_html_test )
+BOOST_AUTO_TEST_CASE( vector_in_c_array_html_print_test )
{
std::stringstream str_out;
@@ -35,7 +34,7 @@
"</table>\n");
str_out.str("");
-
+
std::vector<int> arrvi3[] = {vi,vi,vi};
explore::print(arrvi3, str_out, explore::html_table_format(), explore::default_container_policy());
BOOST_CHECK_EQUAL(str_out.str(),
@@ -46,3 +45,39 @@
"</table>\n");
}
+std::ostream& html_table_stream_format(std::ostream& ostr)
+{
+ using namespace explore;
+ return ostr << start("<table>\n<tr><td>") << separator("</td><td>") << explore::end("</td></tr>\n</table>\n");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_c_array_html_stream_test )
+{
+ std::stringstream str_out;
+ str_out << html_table_stream_format;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::vector<int> arrvi1[] = {vi};
+ str_out << arrvi1;
+
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "<table>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "</table>\n");
+
+ str_out.str("");
+
+ std::vector<int> arrvi3[] = {vi,vi,vi};
+ str_out << arrvi3;
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "<table>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "</table>\n");
+}
+
Modified: sandbox/explore/libs/explore/test/std_deque.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_deque.cpp (original)
+++ sandbox/explore/libs/explore/test/std_deque.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -35,14 +35,14 @@
di.push_back(3);
explore::print(di, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
+
str_out.str("");
-
+
explore::print(di.begin(), ++(++di.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(di.begin(), ++(++di.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
}
@@ -67,16 +67,11 @@
di.push_back(3);
str_out << di;
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- //str_out.str("");
-
- //explore::print(di.begin(), ++(++di.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(di.begin(), ++(++di.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(di.begin(), ++(++di.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
}
BOOST_AUTO_TEST_CASE( deque_in_deque_print_test )
@@ -104,14 +99,14 @@
ddi.push_back(di);
explore::print(ddi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(ddi.begin(), ++(++ddi.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(ddi.begin(), ++(++ddi.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
@@ -141,14 +136,9 @@
ddi.push_back(di);
str_out << ddi;
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(ddi.begin(), ++(++ddi.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(ddi.begin(), ++(++ddi.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(ddi.begin(), ++(++ddi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
Modified: sandbox/explore/libs/explore/test/std_list.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_list.cpp (original)
+++ sandbox/explore/libs/explore/test/std_list.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -36,14 +36,14 @@
lc.push_back(std::complex<double>(4,5));
explore::print(lc, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3), (4,5)]");
-
+
str_out.str("");
-
+
explore::print(lc.begin(), ++(++lc.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3)]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(lc.begin(), ++(++lc.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3)]");
}
@@ -68,16 +68,11 @@
lc.push_back(std::complex<double>(4,5));
str_out << lc;
BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3), (4,5)]");
-
- //str_out.str("");
-
- //explore::print(lc.begin(), ++(++lc.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3)]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(lc.begin(), ++(++lc.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3)]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(lc.begin(), ++(++lc.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3)]");
}
BOOST_AUTO_TEST_CASE( list_in_list_print_test )
@@ -105,14 +100,14 @@
lli.push_back(li);
explore::print(lli, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(lli.begin(), ++(++lli.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(lli.begin(), ++(++lli.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
@@ -142,14 +137,9 @@
lli.push_back(li);
str_out << lli;
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(lli.begin(), ++(++lli.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(lli.begin(), ++(++lli.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(lli.begin(), ++(++lli.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
Modified: sandbox/explore/libs/explore/test/std_map.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_map.cpp (original)
+++ sandbox/explore/libs/explore/test/std_map.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -36,14 +36,14 @@
mis.insert(std::make_pair(3, "third"));
explore::print(mis, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
-
+
str_out.str("");
-
+
explore::print(mis.begin(), ++(++mis.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(mis.begin(), ++(++mis.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second]");
}
@@ -68,16 +68,11 @@
mis.insert(std::make_pair(3, "third"));
str_out << mis;
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
-
- //str_out.str("");
-
- //explore::print(mis.begin(), ++(++mis.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(mis.begin(), ++(++mis.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(mis.begin(), ++(++mis.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second]");
}
BOOST_AUTO_TEST_CASE( basic_multimap_print_test )
@@ -107,14 +102,14 @@
mmis.insert(std::make_pair(3, "triple"));
explore::print(mmis, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single, 2:second, 3:third, 3:triple]");
-
+
str_out.str("");
-
+
explore::print(mmis.begin(), ++(++mmis.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(mmis.begin(), ++(++mmis.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
}
@@ -146,16 +141,11 @@
mmis.insert(std::make_pair(3, "triple"));
str_out << mmis;
BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single, 2:second, 3:third, 3:triple]");
-
- //str_out.str("");
-
- //explore::print(mmis.begin(), ++(++mmis.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(mmis.begin(), ++(++mmis.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(mmis.begin(), ++(++mmis.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
}
BOOST_AUTO_TEST_CASE( vector_in_map_print_test )
@@ -183,14 +173,14 @@
mivi.insert(std::make_pair(3, vi));
explore::print(mivi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3], 3:[1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(mivi.begin(), ++(++mivi.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(mivi.begin(), ++(++mivi.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
}
@@ -220,14 +210,9 @@
mivi.insert(std::make_pair(3, vi));
str_out << mivi;
BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3], 3:[1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(mivi.begin(), ++(++mivi.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(mivi.begin(), ++(++mivi.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(mivi.begin(), ++(++mivi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
}
Modified: sandbox/explore/libs/explore/test/std_set.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_set.cpp (original)
+++ sandbox/explore/libs/explore/test/std_set.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -35,14 +35,14 @@
si.insert(3);
explore::print(si, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
+
str_out.str("");
-
+
explore::print(si.begin(), ++(++si.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(si.begin(), ++(++si.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
}
@@ -67,16 +67,11 @@
si.insert(3);
str_out << si;
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- //str_out.str("");
-
- //explore::print(si.begin(), ++(++si.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(si.begin(), ++(++si.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(si.begin(), ++(++si.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
}
BOOST_AUTO_TEST_CASE( basic_multiset_print_test )
@@ -106,14 +101,14 @@
msi.insert(3);
explore::print(msi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 1, 2, 3, 3]");
-
+
str_out.str("");
-
+
explore::print(msi.begin(), ++(++msi.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(msi.begin(), ++(++msi.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
}
@@ -145,16 +140,11 @@
msi.insert(3);
str_out << msi;
BOOST_CHECK_EQUAL(str_out.str(), "[1, 1, 2, 3, 3]");
-
- //str_out.str("");
-
- //explore::print(msi.begin(), ++(++msi.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(msi.begin(), ++(++msi.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(msi.begin(), ++(++msi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
}
BOOST_AUTO_TEST_CASE( vector_in_set_print_test )
@@ -182,14 +172,14 @@
svi.insert(vi);
explore::print(svi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(svi.begin(), ++(++svi.begin()), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
+
str_out.str("");
-
+
explore::print(boost::make_iterator_range(svi.begin(), ++(++svi.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
@@ -219,14 +209,9 @@
svi.insert(vi);
str_out << svi;
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(svi.begin(), ++(++svi.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
-
- //explore::print(boost::make_iterator_range(svi.begin(), ++(++svi.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(svi.begin(), ++(++svi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
Modified: sandbox/explore/libs/explore/test/std_vector.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_vector.cpp (original)
+++ sandbox/explore/libs/explore/test/std_vector.cpp 2007-05-27 20:58:59 EDT (Sun, 27 May 2007)
@@ -19,19 +19,19 @@
BOOST_AUTO_TEST_CASE( vector_custom_format_print_test )
{
std::stringstream str_out;
-
+
std::vector<int> vi;
explore::print(vi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
+
str_out.str("");
-
+
vi.push_back(1);
explore::print(vi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
+
str_out.str("");
-
+
vi.push_back(2);
vi.push_back(3);
explore::print(vi, str_out);
@@ -46,9 +46,9 @@
explore::print(boost::make_iterator_range(vi.begin(), ++(++vi.begin())), str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
+
str_out.str("");
-
+
explore::print(vi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
}
@@ -56,56 +56,51 @@
BOOST_AUTO_TEST_CASE( basic_vector_stream_test )
{
std::stringstream str_out;
-
+
std::vector<int> vi;
str_out << vi;
BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
+
str_out.str("");
-
+
vi.push_back(1);
str_out << vi;
BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
+
str_out.str("");
-
+
vi.push_back(2);
vi.push_back(3);
str_out << vi;
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
- //str_out.str("");
-
- //explore::print(vi.begin(), ++(++vi.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
- //str_out.str("");
+ str_out.str("");
- //explore::print(boost::make_iterator_range(vi.begin(), ++(++vi.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+ str_out << explore::make_iterator_range(vi.begin(), ++(++vi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
}
BOOST_AUTO_TEST_CASE( vector_in_vector_print_test )
{
std::stringstream str_out;
-
+
std::vector<int> vi;
vi.push_back(1);
vi.push_back(2);
vi.push_back(3);
-
+
std::vector<std::vector<int> > vvi;
explore::print(vvi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
+
str_out.str("");
-
+
vvi.push_back(vi);
explore::print(vvi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
+
str_out.str("");
-
+
vvi.push_back(vi);
vvi.push_back(vi);
explore::print(vvi, str_out);
@@ -125,38 +120,33 @@
BOOST_AUTO_TEST_CASE( vector_in_vector_stream_test )
{
std::stringstream str_out;
-
+
std::vector<int> vi;
vi.push_back(1);
vi.push_back(2);
vi.push_back(3);
-
+
std::vector<std::vector<int> > vvi;
str_out << vvi;
BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
+
str_out.str("");
-
+
vvi.push_back(vi);
str_out << vvi;
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
+
str_out.str("");
-
+
vvi.push_back(vi);
vvi.push_back(vi);
str_out << vvi;
BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
- //str_out.str("");
-
- //explore::print(vvi.begin(), ++(++vvi.begin()), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
- //str_out.str("");
+ str_out.str("");
- //explore::print(boost::make_iterator_range(vvi.begin(), ++(++vvi.begin())), str_out);
- //BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+ str_out << explore::make_iterator_range(vvi.begin(), ++(++vvi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
}
// This test shows that you can use a string to cause the same outputs
@@ -164,7 +154,7 @@
BOOST_AUTO_TEST_CASE( vector_with_ugly_string_case_print_test )
{
std::stringstream str_out;
-
+
std::vector<std::string> vs;
vs.push_back("[1, 2, 3], [1, 2, 3], [1, 2, 3]");
explore::print(vs, str_out);
@@ -174,7 +164,7 @@
BOOST_AUTO_TEST_CASE( vector_with_ugly_string_case_stream_test )
{
std::stringstream str_out;
-
+
std::vector<std::string> vs;
vs.push_back("[1, 2, 3], [1, 2, 3], [1, 2, 3]");
str_out << vs;
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