Boost logo

Boost-Commit :

From: jefffaust_at_[hidden]
Date: 2007-05-22 20:19:45


Author: jefffaust
Date: 2007-05-22 20:19:43 EDT (Tue, 22 May 2007)
New Revision: 4201
URL: http://svn.boost.org/trac/boost/changeset/4201

Log:
Add streaming testcases to mirror printing testcases.

Text files modified:
   sandbox/explore/libs/explore/test/boost_any.cpp | 37 +++++++++++++
   sandbox/explore/libs/explore/test/boost_array.cpp | 54 +++++++++++++++++++
   sandbox/explore/libs/explore/test/boost_tuple.cpp | 15 ++++
   sandbox/explore/libs/explore/test/boost_variant.cpp | 35 ++++++++++++-
   sandbox/explore/libs/explore/test/simple_types.cpp | 105 ++++++++++++++++++++++++++++++++++++---
   sandbox/explore/libs/explore/test/std_map.cpp | 92 +++++++++++++++++++++++++++++++++-
   sandbox/explore/libs/explore/test/std_pair.cpp | 42 ++++++++++++++-
   sandbox/explore/libs/explore/test/std_set.cpp | 92 +++++++++++++++++++++++++++++++++-
   sandbox/explore/libs/explore/test/std_vector.cpp | 71 +++++++++++++++++++++++++-
   9 files changed, 507 insertions(+), 36 deletions(-)

Modified: sandbox/explore/libs/explore/test/boost_any.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_any.cpp (original)
+++ sandbox/explore/libs/explore/test/boost_any.cpp 2007-05-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -13,8 +13,9 @@
 #include <sstream>
 #include <boost/any.hpp>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_any_test )
+BOOST_AUTO_TEST_CASE( basic_any_print_test )
 {
         std::stringstream str_out;
         
@@ -43,4 +44,36 @@
         anyVal = vi;
         explore::print(anyVal, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
-}
\ No newline at end of file
+}
+
+BOOST_AUTO_TEST_CASE( basic_any_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ boost::any anyVal;
+ str_out << anyVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "");
+
+ str_out.str("");
+
+ anyVal = 1;
+ str_out << anyVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "1");
+
+ str_out.str("");
+
+ anyVal = std::string("some string");
+ str_out << anyVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "some string");
+
+ str_out.str("");
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+ anyVal = vi;
+ str_out << anyVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
+}

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-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -13,8 +13,9 @@
 #include <sstream>
 #include <boost/array.hpp>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_array_test )
+BOOST_AUTO_TEST_CASE( basic_array_print_test )
 {
         std::stringstream str_out;
         
@@ -35,7 +36,29 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
 }
 
-BOOST_AUTO_TEST_CASE( vector_in_array_test )
+BOOST_AUTO_TEST_CASE( basic_array_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ boost::array<int,0> ai0;
+ str_out << ai0;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ boost::array<int,1> ai1 = {1};
+ str_out << ai1;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ boost::array<int,3> ai3 = {1, 2, 3};
+ str_out << ai3;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_array_print_test )
 {
         std::stringstream str_out;
         
@@ -60,3 +83,30 @@
         explore::print(av3, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
 }
+
+BOOST_AUTO_TEST_CASE( vector_in_array_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ boost::array<std::vector<int>,0> av0;
+ str_out << av0;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ boost::array<std::vector<int>,1> av1 = {vi};
+ str_out << av1;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ 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]]");
+}

Modified: sandbox/explore/libs/explore/test/boost_tuple.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_tuple.cpp (original)
+++ sandbox/explore/libs/explore/test/boost_tuple.cpp 2007-05-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -14,12 +14,23 @@
 #include <boost/tuple/tuple.hpp>
 #include <boost/tuple/tuple_io.hpp>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_tuple_test )
+BOOST_AUTO_TEST_CASE( basic_tuple_print_test )
 {
         std::stringstream str_out;
         
         boost::tuples::tuple<int, double> t(1, 3.14);
         explore::print(t, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[1, 3.14]");
-}
\ No newline at end of file
+}
+
+BOOST_AUTO_TEST_CASE( basic_tuple_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ boost::tuples::tuple<int, double> t(1, 3.14);
+ str_out << t;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 3.14]");
+}

Modified: sandbox/explore/libs/explore/test/boost_variant.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_variant.cpp (original)
+++ sandbox/explore/libs/explore/test/boost_variant.cpp 2007-05-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -13,8 +13,9 @@
 #include <sstream>
 #include <boost/variant.hpp>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_variant_test )
+BOOST_AUTO_TEST_CASE( basic_variant_print_test )
 {
         std::stringstream str_out;
         
@@ -38,5 +39,33 @@
         vi.push_back(3);
         varVal = vi;
         explore::print(varVal, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
-}
\ No newline at end of file
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( basic_variant_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ boost::variant< int, std::string, std::vector<int> > varVal;
+
+ varVal = 1;
+ str_out << varVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "1");
+
+ str_out.str("");
+
+ varVal = std::string("some string");
+ str_out << varVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "some string");
+
+ str_out.str("");
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+ varVal = vi;
+ str_out << varVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}

Modified: sandbox/explore/libs/explore/test/simple_types.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/simple_types.cpp (original)
+++ sandbox/explore/libs/explore/test/simple_types.cpp 2007-05-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -14,10 +14,10 @@
 #include <iomanip>
 #include <boost/lexical_cast.hpp>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( int_test )
+BOOST_AUTO_TEST_CASE( int_print_test )
 {
-
         std::stringstream str_out;
         int i = 123;
         
@@ -37,36 +37,81 @@
         delete pi;
 }
 
-BOOST_AUTO_TEST_CASE( float_test )
+BOOST_AUTO_TEST_CASE( int_stream_test )
+{
+ std::stringstream str_out;
+ int i = 123;
+
+ str_out << i;
+ BOOST_CHECK_EQUAL(str_out.str(), "123");
+
+ str_out.str("");
+ int* pi = new int(123);
+
+ str_out << pi;
+ // technically, we should force this to be true, though
+ // it is highly unlikely to be false. Otherwise this test is only
+ // telling you whether the following is even valid.
+ BOOST_CHECK(0 != boost::lexical_cast<std::string>((long)pi).compare("123"));
+ BOOST_CHECK_EQUAL(str_out.str(), "123");
+
+ delete pi;
+}
+
+BOOST_AUTO_TEST_CASE( float_print_test )
+{
+ std::stringstream str_out;
+ float f = 1.234f;
+
+ str_out << std::setprecision( 4) << explore::container_format() % f;
+ BOOST_CHECK_EQUAL(str_out.str(), "1.234");
+
+ BOOST_CHECK_MESSAGE(false, "Test min precision");
+ BOOST_CHECK_MESSAGE(false, "Test max precision");
+}
+
+BOOST_AUTO_TEST_CASE( float_stream_test )
 {
         std::stringstream str_out;
         float f = 1.234f;
         
- str_out << std::setprecision( 4) << explore::container_format() % f;
+ str_out << std::setprecision(4) << f;
         BOOST_CHECK_EQUAL(str_out.str(), "1.234");
         
         BOOST_CHECK_MESSAGE(false, "Test min precision");
         BOOST_CHECK_MESSAGE(false, "Test max precision");
 }
 
-BOOST_AUTO_TEST_CASE( double_test )
+BOOST_AUTO_TEST_CASE( double_print_test )
 {
         std::stringstream str_out;
         double d = 1.2341234f;
         
- str_out << std::setprecision(7) << explore::container_format() % d;
+ str_out << std::setprecision(7) << explore::container_format() % d;
         BOOST_CHECK_EQUAL(str_out.str(), "1.234123");
         
         BOOST_CHECK_MESSAGE(false, "Test min precision");
         BOOST_CHECK_MESSAGE(false, "Test max precision");
 }
 
-BOOST_AUTO_TEST_CASE( bool_test )
+BOOST_AUTO_TEST_CASE( double_stream_test )
+{
+ std::stringstream str_out;
+ double d = 1.2341234f;
+
+ str_out << std::setprecision(7) << d;
+ BOOST_CHECK_EQUAL(str_out.str(), "1.234123");
+
+ BOOST_CHECK_MESSAGE(false, "Test min precision");
+ BOOST_CHECK_MESSAGE(false, "Test max precision");
+}
+
+BOOST_AUTO_TEST_CASE( bool_print_test )
 {
         std::stringstream str_out;
         bool b = true;
         
- str_out << std::boolalpha << explore::container_format() %b;
+ str_out << std::boolalpha << explore::container_format() %b;
         BOOST_CHECK_EQUAL(str_out.str(), "true");
         
         str_out.str("");
@@ -76,7 +121,22 @@
         BOOST_CHECK_EQUAL(str_out.str(), "false");
 }
 
-BOOST_AUTO_TEST_CASE( char_test )
+BOOST_AUTO_TEST_CASE( bool_stream_test )
+{
+ std::stringstream str_out;
+ bool b = true;
+
+ str_out << std::boolalpha << b;
+ BOOST_CHECK_EQUAL(str_out.str(), "true");
+
+ str_out.str("");
+ b = false;
+
+ str_out << std::boolalpha << b;
+ BOOST_CHECK_EQUAL(str_out.str(), "false");
+}
+
+BOOST_AUTO_TEST_CASE( char_print_test )
 {
         std::stringstream str_out;
         char c = 'c';
@@ -91,7 +151,22 @@
         BOOST_CHECK_EQUAL(str_out.str(), "c");
 }
 
-BOOST_AUTO_TEST_CASE( string_test )
+BOOST_AUTO_TEST_CASE( char_stream_test )
+{
+ std::stringstream str_out;
+ char c = 'c';
+
+ str_out << c;
+ BOOST_CHECK_EQUAL(str_out.str(), "c");
+
+ str_out.str("");
+ char* pc = "c";
+
+ str_out << pc;
+ BOOST_CHECK_EQUAL(str_out.str(), "c");
+}
+
+BOOST_AUTO_TEST_CASE( string_print_test )
 {
         std::stringstream str_out;
         std::string s = "some string";
@@ -100,3 +175,13 @@
         
         BOOST_CHECK_EQUAL(str_out.str(), "some string");
 }
+
+BOOST_AUTO_TEST_CASE( string_stream_test )
+{
+ std::stringstream str_out;
+ std::string s = "some string";
+
+ str_out << s;
+
+ BOOST_CHECK_EQUAL(str_out.str(), "some string");
+}

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-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -14,8 +14,9 @@
 #include <vector>
 #include <map>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_map_test )
+BOOST_AUTO_TEST_CASE( basic_map_print_test )
 {
         std::stringstream str_out;
         
@@ -37,7 +38,30 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
 }
 
-BOOST_AUTO_TEST_CASE( basic_multimap_test )
+BOOST_AUTO_TEST_CASE( basic_map_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::map<int,std::string> mis;
+ str_out << mis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mis.insert(std::make_pair(1, "first"));
+ str_out << mis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first]");
+
+ str_out.str("");
+
+ mis.insert(std::make_pair(2, "second"));
+ mis.insert(std::make_pair(3, "third"));
+ str_out << mis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
+}
+
+BOOST_AUTO_TEST_CASE( basic_multimap_print_test )
 {
         std::stringstream str_out;
         
@@ -51,7 +75,7 @@
         explore::print(mmis, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[1:first]");
         
- str_out.str("");
+ str_out.str("");
 
         mmis.insert(std::make_pair(1, "single"));
         explore::print(mmis, str_out);
@@ -66,7 +90,37 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single, 2:second, 3:third, 3:triple]");
 }
 
-BOOST_AUTO_TEST_CASE( vector_in_map_test )
+BOOST_AUTO_TEST_CASE( basic_multimap_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::multimap<int,std::string> mmis;
+ str_out << mmis;;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mmis.insert(std::make_pair(1, "first"));
+ str_out << mmis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first]");
+
+ str_out.str("");
+
+ mmis.insert(std::make_pair(1, "single"));
+ str_out << mmis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
+
+ str_out.str("");
+
+ mmis.insert(std::make_pair(2, "second"));
+ mmis.insert(std::make_pair(3, "third"));
+ 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]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_map_print_test )
 {
         std::stringstream str_out;
         
@@ -91,4 +145,32 @@
         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]]");
-}
\ No newline at end of file
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_map_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::map<int,std::vector<int> > mivi;
+ str_out << mivi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mivi.insert(std::make_pair(1, vi));
+ str_out << mivi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3]]");
+
+ str_out.str("");
+
+ mivi.insert(std::make_pair(2, vi));
+ 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]]");
+}

Modified: sandbox/explore/libs/explore/test/std_pair.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_pair.cpp (original)
+++ sandbox/explore/libs/explore/test/std_pair.cpp 2007-05-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -12,8 +12,9 @@
 #include <sstream>
 #include <vector>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_pair_test )
+BOOST_AUTO_TEST_CASE( basic_pair_print_test )
 {
         std::stringstream str_out;
         
@@ -22,10 +23,20 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
 }
 
+BOOST_AUTO_TEST_CASE( basic_pair_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::pair<int,int> pi = std::make_pair(1,2);
+ str_out << pi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+}
+
 // This is an interesting case as it shows a stylistic difference between a vector of
 // pairs and a map. It also shows that if we allow this syntax, simple type and depth
 // formatters will need to be enhanced to meet this requirement.
-BOOST_AUTO_TEST_CASE( pair_in_vector_test )
+BOOST_AUTO_TEST_CASE( pair_in_vector_print_test )
 {
         std::stringstream str_out;
         
@@ -47,4 +58,29 @@
         vpi.push_back(pi);
         explore::print(vpi, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2], [1, 2]]");
-}
\ No newline at end of file
+}
+
+BOOST_AUTO_TEST_CASE( pair_in_vector_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::vector<std::pair<int,int> > vpi;
+ str_out << vpi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ std::pair<int,int> pi = std::make_pair(1,2);
+
+ vpi.push_back(pi);
+ str_out << vpi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2]]");
+
+ str_out.str("");
+
+ vpi.push_back(pi);
+ vpi.push_back(pi);
+ str_out << vpi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2], [1, 2]]");
+}

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-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -13,8 +13,9 @@
 #include <sstream>
 #include <set>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_set_test )
+BOOST_AUTO_TEST_CASE( basic_set_print_test )
 {
         std::stringstream str_out;
         
@@ -36,7 +37,30 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
 }
 
-BOOST_AUTO_TEST_CASE( basic_multiset_test )
+BOOST_AUTO_TEST_CASE( basic_set_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::set<int> si;
+ str_out << si;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ si.insert(1);
+ str_out << si;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ si.insert(2);
+ si.insert(3);
+ str_out << si;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( basic_multiset_print_test )
 {
         std::stringstream str_out;
         
@@ -52,7 +76,7 @@
         
         str_out.str("");
 
- msi.insert(1);
+ msi.insert(1);
         explore::print(msi, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
         
@@ -65,7 +89,37 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[1, 1, 2, 3, 3]");
 }
 
-BOOST_AUTO_TEST_CASE( vector_in_set_test )
+BOOST_AUTO_TEST_CASE( basic_multiset_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::multiset<int> msi;
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ msi.insert(1);
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ msi.insert(1);
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
+
+ str_out.str("");
+
+ msi.insert(2);
+ msi.insert(3);
+ msi.insert(3);
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1, 2, 3, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_set_print_test )
 {
         std::stringstream str_out;
         
@@ -90,4 +144,32 @@
         svi.insert(vi);
         explore::print(svi, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-}
\ No newline at end of file
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_set_stream_test )
+{
+ using namespace boost;
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::multiset<std::vector<int> > svi;
+ str_out << svi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ svi.insert(vi);
+ str_out << svi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ svi.insert(vi);
+ svi.insert(vi);
+ str_out << svi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [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-22 20:19:43 EDT (Tue, 22 May 2007)
@@ -13,8 +13,9 @@
 #include <sstream>
 #include <vector>
 #include "../../../boost/explore/explore.hpp"
+#include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_vector_test )
+BOOST_AUTO_TEST_CASE( basic_vector_print_test )
 {
         std::stringstream str_out;
         
@@ -36,7 +37,30 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
 }
 
-BOOST_AUTO_TEST_CASE( vector_in_vector_test )
+BOOST_AUTO_TEST_CASE( basic_vector_stream_test )
+{
+ using namespace boost;
+ 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]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_vector_print_test )
 {
         std::stringstream str_out;
         
@@ -63,9 +87,37 @@
         BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
 }
 
+BOOST_AUTO_TEST_CASE( vector_in_vector_stream_test )
+{
+ using namespace boost;
+ 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]]");
+}
+
 // This test shows that you can use a string to cause the same outputs
 // as other print statements.
-BOOST_AUTO_TEST_CASE( vector_with_ugly_string_case_test )
+BOOST_AUTO_TEST_CASE( vector_with_ugly_string_case_print_test )
 {
         std::stringstream str_out;
         
@@ -73,4 +125,15 @@
         vs.push_back("[1, 2, 3], [1, 2, 3], [1, 2, 3]");
         explore::print(vs, str_out);
         BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-}
\ No newline at end of file
+}
+
+BOOST_AUTO_TEST_CASE( vector_with_ugly_string_case_stream_test )
+{
+ using namespace boost;
+ 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_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
+}


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