Boost logo

Boost-Commit :

From: jared_at_[hidden]
Date: 2007-05-21 02:29:51


Author: jared
Date: 2007-05-21 02:29:50 EDT (Mon, 21 May 2007)
New Revision: 4153
URL: http://svn.boost.org/trac/boost/changeset/4153

Log:
=checkin_msg

Added:
   sandbox/explore/libs/explore/test/boost_any.cpp
   sandbox/explore/libs/explore/test/boost_array.cpp
   sandbox/explore/libs/explore/test/std_set.cpp
Text files modified:
   sandbox/explore/libs/explore/test/Jamfile.v2 | 66 ++++++++-------
   sandbox/explore/libs/explore/test/simple_types.cpp | 1
   sandbox/explore/libs/explore/test/std_map.cpp | 161 ++++++++++++++++++++++-----------------
   sandbox/explore/libs/explore/test/std_pair.cpp | 104 ++++++++++++-------------
   sandbox/explore/libs/explore/test/std_vector.cpp | 156 ++++++++++++++++++--------------------
   5 files changed, 249 insertions(+), 239 deletions(-)

Modified: sandbox/explore/libs/explore/test/Jamfile.v2
==============================================================================
--- sandbox/explore/libs/explore/test/Jamfile.v2 (original)
+++ sandbox/explore/libs/explore/test/Jamfile.v2 2007-05-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -1,32 +1,34 @@
-# Boost.Print Library
-
-# Copyright Jared McIntyre 2007. Use, modification and
-# distribution is subject to 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)
-
-# For more information, see http://www.boost.org
-
-# bring in rules for testing
-import testing ;
-
-project
- : source-location .
- : requirements
- <hardcode-dll-paths>true
- <library>../../test/build//boost_test_exec_monitor
- #<library>../build//print
- ;
-{
- test-suite signals
- :
- [ run simple_types.cpp ]
-
- [ run std_vector.cpp ]
-
- [ run std_map.cpp ]
-
- [ run std_pair.cpp ]
- ;
-}
-
+# Boost.Print Library
+
+# Copyright Jared McIntyre 2007. Use, modification and
+# distribution is subject to 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)
+
+# For more information, see http://www.boost.org
+
+# bring in rules for testing
+import testing ;
+
+project
+ : source-location .
+ : requirements
+ <hardcode-dll-paths>true
+ <library>../../test/build//boost_test_exec_monitor
+ #<library>../build//print
+ ;
+{
+ test-suite signals
+ :
+ [ run simple_types.cpp ]
+
+ [ run std_vector.cpp ]
+ [ run std_map.cpp ]
+ [ run std_set.cpp ]
+ [ run std_pair.cpp ]
+
+ [ run boost_array.cpp ]
+ [ run boost_any.cpp ]
+ ;
+}
+

Added: sandbox/explore/libs/explore/test/boost_any.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/boost_any.cpp 2007-05-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -0,0 +1,46 @@
+// Boost.Print library
+
+// Copyright Jared McIntyre 2007. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#define BOOST_TEST_MODULE PrintLib
+#include <boost/test/unit_test.hpp>
+#include <string>
+#include <sstream>
+#include <boost/any.hpp>
+#include "../../../boost/explore/explore.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_any_test )
+{
+ std::stringstream str_out;
+
+ boost::any anyVal;
+ explore::print(anyVal, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "");
+
+ str_out.str("");
+
+ anyVal = 1;
+ explore::print(anyVal, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "1");
+
+ str_out.str("");
+
+ anyVal = std::string("some string");
+ explore::print(anyVal, str_out);
+ 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;
+ explore::print(anyVal, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
+}
\ No newline at end of file

Added: sandbox/explore/libs/explore/test/boost_array.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/boost_array.cpp 2007-05-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -0,0 +1,62 @@
+// Boost.Print library
+
+// Copyright Jared McIntyre 2007. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#define BOOST_TEST_MODULE PrintLib
+#include <boost/test/unit_test.hpp>
+#include <string>
+#include <sstream>
+#include <boost/array.hpp>
+#include "../../../boost/explore/explore.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_array_test )
+{
+ std::stringstream str_out;
+
+ boost::array<int,0> ai0;
+ explore::print(ai0, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ boost::array<int,1> ai1 = {1};
+ explore::print(ai1, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ boost::array<int,3> ai3 = {1, 2, 3};
+ explore::print(ai3, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_array_test )
+{
+ 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;
+ explore::print(av0, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ boost::array<std::vector<int>,1> av1 = {vi};
+ explore::print(av1, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ 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]]");
+}

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-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -9,7 +9,6 @@
 
 #define BOOST_TEST_MODULE PrintLib
 #include <boost/test/unit_test.hpp>
-//#include <boost/print.hpp>
 #include <string>
 #include <sstream>
 #include <boost/lexical_cast.hpp>

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-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -1,71 +1,92 @@
-// Boost.Print library
-
-// Copyright Jared McIntyre 2007. Use, modification and
-// distribution is subject to 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)
-
-// For more information, see http://www.boost.org
-
-#define BOOST_TEST_MODULE PrintLib
-#include <boost/test/unit_test.hpp>
-//#include <boost/print.hpp>
-#include <string>
-#include <sstream>
-#include <vector>
-#include <map>
-
-template<typename T>
-void print(T t, std::stringstream &str_out)
-{
- str_out << "!!! fail test !!!";
-}
-
-BOOST_AUTO_TEST_CASE( basic_map_test )
-{
- std::stringstream str_out;
-
- std::map<int,std::string> mis;
- print(mis, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- mis.insert(std::make_pair(1, "first"));
- print(mis, str_out);
- 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"));
- print(mis, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_map_test )
-{
- 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;
- print(mivi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- mivi.insert(std::make_pair(1, vi));
- print(mivi, str_out);
- 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));
- print(mivi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1:[1,2,3], 2:[1,2,3], 3:[1,2,3]]");
+// Boost.Print library
+
+// Copyright Jared McIntyre 2007. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#define BOOST_TEST_MODULE PrintLib
+#include <boost/test/unit_test.hpp>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <map>
+#include "../../../boost/explore/explore.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_map_test )
+{
+ std::stringstream str_out;
+
+ std::map<int,std::string> mis;
+ explore::print(mis, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mis.insert(std::make_pair(1, "first"));
+ explore::print(mis, str_out);
+ 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"));
+ explore::print(mis, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
+}
+
+BOOST_AUTO_TEST_CASE( basic_multimap_test )
+{
+ std::stringstream str_out;
+
+ std::multimap<int,std::string> mmis;
+ explore::print(mmis, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mmis.insert(std::make_pair(1, "first"));
+ explore::print(mmis, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first]");
+
+ mmis.insert(std::make_pair(1, "single"));
+ explore::print(mmis, str_out);
+ 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"));
+ explore::print(mmis, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single, 2:second, 3:third, 3:triple]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_map_test )
+{
+ 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;
+ explore::print(mivi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mivi.insert(std::make_pair(1, vi));
+ explore::print(mivi, str_out);
+ 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));
+ 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

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-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -1,56 +1,50 @@
-// Boost.Print library
-
-// Copyright Jared McIntyre 2007. Use, modification and
-// distribution is subject to 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)
-
-// For more information, see http://www.boost.org
-
-#define BOOST_TEST_MODULE PrintLib
-#include <boost/test/unit_test.hpp>
-//#include <boost/print.hpp>
-#include <sstream>
-#include <vector>
-
-template<typename T>
-void print(T t, std::stringstream &str_out)
-{
- str_out << "!!! fail test !!!";
-}
-
-BOOST_AUTO_TEST_CASE( basic_pair_test )
-{
- std::stringstream str_out;
-
- std::pair<int,int> pi = std::make_pair(1,2);
- print(pi, str_out);
- 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 )
-{
- std::stringstream str_out;
-
- std::vector<std::pair<int,int> > vpi;
- print(vpi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- std::pair<int,int> pi = std::make_pair(1,2);
-
- vpi.push_back(pi);
- print(vpi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2]]");
-
- str_out.str("");
-
- vpi.push_back(pi);
- vpi.push_back(pi);
- print(vpi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2], [1, 2]]");
+// Boost.Print library
+
+// Copyright Jared McIntyre 2007. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#define BOOST_TEST_MODULE PrintLib
+#include <boost/test/unit_test.hpp>
+#include <sstream>
+#include <vector>
+#include "../../../boost/explore/explore.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_pair_test )
+{
+ std::stringstream str_out;
+
+ std::pair<int,int> pi = std::make_pair(1,2);
+ explore::print(pi, str_out);
+ 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 )
+{
+ std::stringstream str_out;
+
+ std::vector<std::pair<int,int> > vpi;
+ explore::print(vpi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ std::pair<int,int> pi = std::make_pair(1,2);
+
+ vpi.push_back(pi);
+ explore::print(vpi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2]]");
+
+ str_out.str("");
+
+ vpi.push_back(pi);
+ 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

Added: sandbox/explore/libs/explore/test/std_set.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/std_set.cpp 2007-05-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -0,0 +1,91 @@
+// Boost.Print library
+
+// Copyright Jared McIntyre 2007. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#define BOOST_TEST_MODULE PrintLib
+#include <boost/test/unit_test.hpp>
+#include <string>
+#include <sstream>
+#include <set>
+#include "../../../boost/explore/explore.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_set_test )
+{
+ std::stringstream str_out;
+
+ std::set<int> si;
+ explore::print(si, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ si.insert(1);
+ explore::print(si, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ si.insert(2);
+ si.insert(3);
+ explore::print(si, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( basic_multiset_test )
+{
+ std::stringstream str_out;
+
+ std::multiset<int> msi;
+ explore::print(msi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ msi.insert(1);
+ explore::print(msi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ msi.insert(1);
+ explore::print(msi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
+
+ str_out.str("");
+
+ msi.insert(2);
+ msi.insert(3);
+ msi.insert(3);
+ explore::print(msi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1, 2, 3, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_set_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::set<std::vector<int> > svi;
+ explore::print(svi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ svi.insert(vi);
+ explore::print(svi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1,2,3]]");
+
+ str_out.str("");
+
+ svi.insert(vi);
+ 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

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-21 02:29:50 EDT (Mon, 21 May 2007)
@@ -1,82 +1,76 @@
-// Boost.Print library
-
-// Copyright Jared McIntyre 2007. Use, modification and
-// distribution is subject to 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)
-
-// For more information, see http://www.boost.org
-
-#define BOOST_TEST_MODULE PrintLib
-#include <boost/test/unit_test.hpp>
-//#include <boost/print.hpp>
-#include <string>
-#include <sstream>
-#include <vector>
-
-template<typename T>
-void print(T t, std::stringstream &str_out)
-{
- str_out << "!!! fail test !!!";
-}
-
-BOOST_AUTO_TEST_CASE( basic_vector_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- print(vi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- vi.push_back(1);
- print(vi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- vi.push_back(2);
- vi.push_back(3);
- print(vi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_vector_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;
- print(vvi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- vvi.push_back(vi);
- print(vvi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- vvi.push_back(vi);
- vvi.push_back(vi);
- print(vvi, str_out);
- 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 )
-{
- std::stringstream str_out;
-
- std::vector<std::string> vs;
- vs.push_back("[1, 2, 3], [1, 2, 3], [1, 2, 3]");
- print(vs, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
+// Boost.Print library
+
+// Copyright Jared McIntyre 2007. Use, modification and
+// distribution is subject to 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)
+
+// For more information, see http://www.boost.org
+
+#define BOOST_TEST_MODULE PrintLib
+#include <boost/test/unit_test.hpp>
+#include <string>
+#include <sstream>
+#include <vector>
+#include "../../../boost/explore/explore.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_vector_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);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_vector_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);
+ 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 )
+{
+ 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);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
 }
\ No newline at end of file


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