Boost logo

Boost-Commit :

From: jefffaust_at_[hidden]
Date: 2007-05-24 00:13:24


Author: jefffaust
Date: 2007-05-24 00:13:24 EDT (Thu, 24 May 2007)
New Revision: 4221
URL: http://svn.boost.org/trac/boost/changeset/4221

Log:
Add std_list test

Added:
   sandbox/explore/libs/explore/test/std_list.cpp
      - copied, changed from r4218, /sandbox/explore/libs/explore/test/std_vector.cpp
Text files modified:
   sandbox/explore/libs/explore/test/Jamfile.v2 | 3
   sandbox/explore/libs/explore/test/std_list.cpp | 114 ++++++++++++++++-----------------------
   2 files changed, 47 insertions(+), 70 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-24 00:13:24 EDT (Thu, 24 May 2007)
@@ -15,7 +15,6 @@
     : requirements
         <hardcode-dll-paths>true
         <library>../../test/build//boost_test_exec_monitor
- #<library>../build//print
     ;
 {
   test-suite printing
@@ -23,6 +22,7 @@
   [ run simple_types.cpp ]
 
   [ run std_vector.cpp ]
+ [ run std_list.cpp ]
   [ run std_map.cpp ]
   [ run std_set.cpp ]
   [ run std_pair.cpp ]
@@ -33,4 +33,3 @@
   [ run boost_variant.cpp ]
  ;
 }
-

Copied: sandbox/explore/libs/explore/test/std_list.cpp (from r4218, /sandbox/explore/libs/explore/test/std_vector.cpp)
==============================================================================
--- /sandbox/explore/libs/explore/test/std_vector.cpp (original)
+++ sandbox/explore/libs/explore/test/std_list.cpp 2007-05-24 00:13:24 EDT (Thu, 24 May 2007)
@@ -11,129 +11,107 @@
 #include <boost/test/unit_test.hpp>
 #include <string>
 #include <sstream>
-#include <vector>
+#include <list>
+#include <complex>
 #include "../../../boost/explore/explore.hpp"
 #include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_vector_print_test )
+BOOST_AUTO_TEST_CASE( basic_list_print_test )
 {
     std::stringstream str_out;
 
- std::vector<int> vi;
- explore::print(vi, str_out);
+ std::list<std::complex<double> > lc;
+ explore::print(lc, 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]");
+ lc.push_back(std::complex<double>(0,1));
+ explore::print(lc, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[(0,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]");
+ lc.push_back(std::complex<double>(2,3));
+ 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)]");
 }
 
-BOOST_AUTO_TEST_CASE( basic_vector_stream_test )
+BOOST_AUTO_TEST_CASE( basic_list_stream_test )
 {
     using namespace boost;
     std::stringstream str_out;
 
- std::vector<int> vi;
- str_out << vi;
+ std::list<std::complex<double> > lc;
+ str_out << lc;
     BOOST_CHECK_EQUAL(str_out.str(), "[]");
 
     str_out.str("");
 
- vi.push_back(1);
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+ lc.push_back(std::complex<double>(0,1));
+ str_out << lc;
+ BOOST_CHECK_EQUAL(str_out.str(), "[(0,1)]");
 
     str_out.str("");
 
- vi.push_back(2);
- vi.push_back(3);
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+ lc.push_back(std::complex<double>(2,3));
+ lc.push_back(std::complex<double>(4,5));
+ str_out << lc;
+ BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3), (4,5)]");
 }
 
-BOOST_AUTO_TEST_CASE( vector_in_vector_print_test )
+BOOST_AUTO_TEST_CASE( list_in_list_print_test )
 {
     std::stringstream str_out;
 
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
+ std::list<int> li;
+ li.push_back(1);
+ li.push_back(2);
+ li.push_back(3);
 
- std::vector<std::vector<int> > vvi;
- explore::print(vvi, str_out);
+ std::list<std::list<int> > lli;
+ explore::print(lli, str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[]");
 
     str_out.str("");
 
- vvi.push_back(vi);
- explore::print(vvi, str_out);
+ lli.push_back(li);
+ explore::print(lli, 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);
+ lli.push_back(li);
+ lli.push_back(li);
+ explore::print(lli, str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
 }
 
-BOOST_AUTO_TEST_CASE( vector_in_vector_stream_test )
+BOOST_AUTO_TEST_CASE( list_in_list_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::list<int> li;
+ li.push_back(1);
+ li.push_back(2);
+ li.push_back(3);
 
- std::vector<std::vector<int> > vvi;
- str_out << vvi;
+ std::list<std::list<int> > lli;
+ str_out << lli;
     BOOST_CHECK_EQUAL(str_out.str(), "[]");
 
     str_out.str("");
 
- vvi.push_back(vi);
- str_out << vvi;
+ lli.push_back(li);
+ str_out << lli;
     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_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);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-}
-
-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;
+ lli.push_back(li);
+ lli.push_back(li);
+ str_out << lli;
     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