Boost logo

Boost-Commit :

From: jefffaust_at_[hidden]
Date: 2007-05-24 20:21:07


Author: jefffaust
Date: 2007-05-24 20:21:06 EDT (Thu, 24 May 2007)
New Revision: 4231
URL: http://svn.boost.org/trac/boost/changeset/4231

Log:
add boos_range, but disabled until we decide what it should do.

Added:
   sandbox/explore/libs/explore/test/boost_range.cpp
      - copied, changed from r4230, /sandbox/explore/libs/explore/test/boost_array.cpp
Text files modified:
   sandbox/explore/libs/explore/test/Jamfile.v2 | 3 +
   sandbox/explore/libs/explore/test/boost_range.cpp | 89 +++++++++------------------------------
   2 files changed, 24 insertions(+), 68 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 20:21:06 EDT (Thu, 24 May 2007)
@@ -32,5 +32,8 @@
   [ run boost_array.cpp ]
   [ run boost_tuple.cpp ]
   [ run boost_variant.cpp ]
+
+ // conflicts with stream operator already defined for iterator_range
+ //[ run boost_range.cpp ]
  ;
 }

Copied: sandbox/explore/libs/explore/test/boost_range.cpp (from r4230, /sandbox/explore/libs/explore/test/boost_array.cpp)
==============================================================================
--- /sandbox/explore/libs/explore/test/boost_array.cpp (original)
+++ sandbox/explore/libs/explore/test/boost_range.cpp 2007-05-24 20:21:06 EDT (Thu, 24 May 2007)
@@ -9,104 +9,57 @@
 
 #define BOOST_TEST_MODULE PrintLib
 #include <boost/test/unit_test.hpp>
-#include <string>
 #include <sstream>
-#include <boost/array.hpp>
+#include <vector>
+#include <boost/range/iterator_range.hpp>
 #include "../../../boost/explore/explore.hpp"
 #include "../../../boost/explore/stream_container.hpp"
 
-BOOST_AUTO_TEST_CASE( basic_array_print_test )
+BOOST_AUTO_TEST_CASE( boost_range_print_test )
 {
     std::stringstream str_out;
 
- boost::array<int,0> ai0;
- explore::print(ai0, str_out);
+ typedef std::vector<int> Cont;
+ typedef boost::iterator_range<Cont::iterator> IterRange;
+ Cont vi;
+ explore::print(IterRange(vi), str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[]");
 
     str_out.str("");
 
- boost::array<int,1> ai1 = {1};
- explore::print(ai1, str_out);
+ vi.push_back(1);
+ explore::print(IterRange(vi), 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);
+ vi.push_back(2);
+ vi.push_back(3);
+ explore::print(IterRange(vi), str_out);
     BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
 }
 
-BOOST_AUTO_TEST_CASE( basic_array_stream_test )
+BOOST_AUTO_TEST_CASE( boost_range_stream_test )
 {
     using namespace boost;
     std::stringstream str_out;
 
- boost::array<int,0> ai0;
- str_out << ai0;
+ typedef std::vector<int> Cont;
+ typedef iterator_range<Cont::iterator> IterRange;
+ Cont vi;
+ str_out << IterRange(vi);
     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;
-
- 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 << IterRange(vi);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
 
     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]]");
-}
-
-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]]");
+ str_out << IterRange(vi);
+ BOOST_CHECK_EQUAL(str_out.str(), "[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