|
Boost-Commit : |
From: jefffaust_at_[hidden]
Date: 2007-05-24 00:29:34
Author: jefffaust
Date: 2007-05-24 00:29:34 EDT (Thu, 24 May 2007)
New Revision: 4223
URL: http://svn.boost.org/trac/boost/changeset/4223
Log:
add std_deque test
Added:
sandbox/explore/libs/explore/test/std_deque.cpp
- copied, changed from r4218, /sandbox/explore/libs/explore/test/std_vector.cpp
Text files modified:
sandbox/explore/libs/explore/test/Jamfile.v2 | 1
sandbox/explore/libs/explore/test/std_deque.cpp | 105 +++++++++++++++------------------------
2 files changed, 42 insertions(+), 64 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:29:34 EDT (Thu, 24 May 2007)
@@ -22,6 +22,7 @@
[ run simple_types.cpp ]
[ run std_vector.cpp ]
+ [ run std_deque.cpp ]
[ run std_list.cpp ]
[ run std_map.cpp ]
[ run std_set.cpp ]
Copied: sandbox/explore/libs/explore/test/std_deque.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_deque.cpp 2007-05-24 00:29:34 EDT (Thu, 24 May 2007)
@@ -11,129 +11,106 @@
#include <boost/test/unit_test.hpp>
#include <string>
#include <sstream>
-#include <vector>
+#include <deque>
#include "../../../boost/explore/explore.hpp"
#include "../../../boost/explore/stream_container.hpp"
-BOOST_AUTO_TEST_CASE( basic_vector_print_test )
+BOOST_AUTO_TEST_CASE( basic_deque_print_test )
{
std::stringstream str_out;
- std::vector<int> vi;
- explore::print(vi, str_out);
+ std::deque<int> di;
+ explore::print(di, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[]");
str_out.str("");
- vi.push_back(1);
- explore::print(vi, str_out);
+ di.push_back(1);
+ explore::print(di, 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);
+ di.push_back(2);
+ di.push_back(3);
+ explore::print(di, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
}
-BOOST_AUTO_TEST_CASE( basic_vector_stream_test )
+BOOST_AUTO_TEST_CASE( basic_deque_stream_test )
{
using namespace boost;
std::stringstream str_out;
- std::vector<int> vi;
- str_out << vi;
+ std::deque<int> di;
+ str_out << di;
BOOST_CHECK_EQUAL(str_out.str(), "[]");
str_out.str("");
- vi.push_back(1);
- str_out << vi;
+ di.push_back(1);
+ str_out << di;
BOOST_CHECK_EQUAL(str_out.str(), "[1]");
str_out.str("");
- vi.push_back(2);
- vi.push_back(3);
- str_out << vi;
+ di.push_back(2);
+ di.push_back(3);
+ str_out << di;
BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
}
-BOOST_AUTO_TEST_CASE( vector_in_vector_print_test )
+BOOST_AUTO_TEST_CASE( deque_in_deque_print_test )
{
std::stringstream str_out;
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
+ std::deque<int> di;
+ di.push_back(1);
+ di.push_back(2);
+ di.push_back(3);
- std::vector<std::vector<int> > vvi;
- explore::print(vvi, str_out);
+ std::deque<std::deque<int> > ddi;
+ explore::print(ddi, str_out);
BOOST_CHECK_EQUAL(str_out.str(), "[]");
str_out.str("");
- vvi.push_back(vi);
- explore::print(vvi, str_out);
+ ddi.push_back(di);
+ explore::print(ddi, 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);
+ ddi.push_back(di);
+ ddi.push_back(di);
+ explore::print(ddi, 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( deque_in_deque_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::deque<int> di;
+ di.push_back(1);
+ di.push_back(2);
+ di.push_back(3);
- std::vector<std::vector<int> > vvi;
- str_out << vvi;
+ std::deque<std::deque<int> > ddi;
+ str_out << ddi;
BOOST_CHECK_EQUAL(str_out.str(), "[]");
str_out.str("");
- vvi.push_back(vi);
- str_out << vvi;
+ ddi.push_back(di);
+ str_out << ddi;
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;
+ ddi.push_back(di);
+ ddi.push_back(di);
+ str_out << ddi;
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