Boost logo

Boost-Commit :

From: jared_at_[hidden]
Date: 2007-05-27 00:55:28


Author: jared
Date: 2007-05-27 00:55:28 EDT (Sun, 27 May 2007)
New Revision: 4302
URL: http://svn.boost.org/trac/boost/changeset/4302

Log:
Added iterator and range tests to other container tests.

Text files modified:
   sandbox/explore/libs/explore/test/boost_array.cpp | 48 ++++++++++++++++++++++++++++++++
   sandbox/explore/libs/explore/test/std_deque.cpp | 40 ++++++++++++++++++++++++++
   sandbox/explore/libs/explore/test/std_list.cpp | 40 ++++++++++++++++++++++++++
   sandbox/explore/libs/explore/test/std_map.cpp | 60 ++++++++++++++++++++++++++++++++++++++++
   sandbox/explore/libs/explore/test/std_set.cpp | 60 ++++++++++++++++++++++++++++++++++++++++
   5 files changed, 248 insertions(+), 0 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 00:55:28 EDT (Sun, 27 May 2007)
@@ -34,6 +34,18 @@
     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;
+
+ 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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_array_stream_test )
@@ -56,6 +68,18 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( vector_in_array_print_test )
@@ -82,6 +106,18 @@
     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;
+
+ 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]]");
 }
 
 BOOST_AUTO_TEST_CASE( vector_in_array_stream_test )
@@ -109,4 +145,16 @@
     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]]");
 }

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 00:55:28 EDT (Sun, 27 May 2007)
@@ -35,6 +35,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_deque_stream_test )
@@ -58,6 +68,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( deque_in_deque_print_test )
@@ -85,6 +105,16 @@
     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]]");
 }
 
 BOOST_AUTO_TEST_CASE( deque_in_deque_stream_test )
@@ -113,4 +143,14 @@
     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]]");
 }

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 00:55:28 EDT (Sun, 27 May 2007)
@@ -36,6 +36,16 @@
     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)]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_list_stream_test )
@@ -59,6 +69,16 @@
     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)]");
 }
 
 BOOST_AUTO_TEST_CASE( list_in_list_print_test )
@@ -86,6 +106,16 @@
     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]]");
 }
 
 BOOST_AUTO_TEST_CASE( list_in_list_stream_test )
@@ -114,4 +144,14 @@
     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]]");
 }

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 00:55:28 EDT (Sun, 27 May 2007)
@@ -36,6 +36,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_map_stream_test )
@@ -59,6 +69,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_multimap_print_test )
@@ -88,6 +108,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_multimap_stream_test )
@@ -118,6 +148,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( vector_in_map_print_test )
@@ -145,6 +185,16 @@
     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]]");
 }
 
 BOOST_AUTO_TEST_CASE( vector_in_map_stream_test )
@@ -173,4 +223,14 @@
     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]]");
 }

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 00:55:28 EDT (Sun, 27 May 2007)
@@ -35,6 +35,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_set_stream_test )
@@ -58,6 +68,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_multiset_print_test )
@@ -87,6 +107,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( basic_multiset_stream_test )
@@ -117,6 +147,16 @@
     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]");
 }
 
 BOOST_AUTO_TEST_CASE( vector_in_set_print_test )
@@ -144,6 +184,16 @@
     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]]");
 }
 
 BOOST_AUTO_TEST_CASE( vector_in_set_stream_test )
@@ -172,4 +222,14 @@
     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]]");
 }


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