|
Boost-Commit : |
From: jmcintyre_at_[hidden]
Date: 2007-08-03 01:28:33
Author: jared
Date: 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
New Revision: 38411
URL: http://svn.boost.org/trac/boost/changeset/38411
Log:
rearrange explore tests to split print from stream
Added:
sandbox/explore/libs/explore/test/print/
sandbox/explore/libs/explore/test/print/Jamfile.v2 (contents, props changed)
sandbox/explore/libs/explore/test/print/basic_lg_format.hpp
- copied, changed from r38410, /sandbox/explore/libs/explore/test/basic_lg_format.hpp
sandbox/explore/libs/explore/test/print/boost_array.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/boost_range.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/boost_tuple.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/boost_variant.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/c_array.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/columnated.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/custom_format_simple.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/html_table_output.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/multi_dim_test.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/simple_types.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/std_deque.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/std_list.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/std_map.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/std_pair.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/std_set.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/std_vector.cpp (contents, props changed)
sandbox/explore/libs/explore/test/print/user_defined_container.cpp (contents, props changed)
sandbox/explore/libs/explore/test/shared/
sandbox/explore/libs/explore/test/shared/Jamfile.v2 (contents, props changed)
sandbox/explore/libs/explore/test/shared/is_assoc_iter.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/
sandbox/explore/libs/explore/test/stream/Jamfile.v2 (contents, props changed)
sandbox/explore/libs/explore/test/stream/basic_lg_format.hpp
- copied, changed from r38410, /sandbox/explore/libs/explore/test/basic_lg_format.hpp
sandbox/explore/libs/explore/test/stream/boost_array.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/boost_range.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/boost_tuple.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/boost_variant.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/c_array.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/columnated.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/custom_format_simple.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/html_table_output.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/multi_dim_test.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/simple_types.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/std_deque.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/std_list.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/std_map.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/std_pair.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/std_set.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/std_vector.cpp (contents, props changed)
sandbox/explore/libs/explore/test/stream/user_defined_container.cpp (contents, props changed)
Removed:
sandbox/explore/libs/explore/test/basic_lg_format.hpp
sandbox/explore/libs/explore/test/boost_array.cpp
sandbox/explore/libs/explore/test/boost_range.cpp
sandbox/explore/libs/explore/test/boost_tuple.cpp
sandbox/explore/libs/explore/test/boost_variant.cpp
sandbox/explore/libs/explore/test/c_array.cpp
sandbox/explore/libs/explore/test/columnated.cpp
sandbox/explore/libs/explore/test/custom_format_simple.cpp
sandbox/explore/libs/explore/test/html_table_output.cpp
sandbox/explore/libs/explore/test/is_assoc_iter.cpp
sandbox/explore/libs/explore/test/multi_dim_test.cpp
sandbox/explore/libs/explore/test/simple_types.cpp
sandbox/explore/libs/explore/test/std_deque.cpp
sandbox/explore/libs/explore/test/std_list.cpp
sandbox/explore/libs/explore/test/std_map.cpp
sandbox/explore/libs/explore/test/std_pair.cpp
sandbox/explore/libs/explore/test/std_set.cpp
sandbox/explore/libs/explore/test/std_vector.cpp
sandbox/explore/libs/explore/test/user_defined_container.cpp
Text files modified:
sandbox/explore/libs/explore/test/Jamfile.v2 | 40 ++++------------------------------------
sandbox/explore/libs/explore/test/print/basic_lg_format.hpp | 15 +++------------
sandbox/explore/libs/explore/test/stream/basic_lg_format.hpp | 23 ++---------------------
3 files changed, 9 insertions(+), 69 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-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -1,4 +1,4 @@
-# Boost.Print Library
+# Boost.Explore Library
# Copyright Jared McIntyre 2007. Use, modification and
# distribution is subject to the Boost Software License, Version
@@ -7,38 +7,6 @@
# For more information, see http://www.boost.org
-# bring in rules for testing
-import testing ;
-
-project
- : source-location .
- : requirements
- ;
-{
- test-suite printing
- :
- [ run simple_types.cpp ]
- [ run c_array.cpp ]
- [ run user_defined_container.cpp ]
-
- [ run std_vector.cpp ]
- [ run std_deque.cpp ]
- [ run std_list.cpp ]
- [ run std_map.cpp ]
- [ run std_set.cpp ]
- [ run std_pair.cpp ]
-
- [ run boost_array.cpp ]
- [ run boost_tuple.cpp ]
- [ run boost_variant.cpp ]
-
- [ run boost_range.cpp ]
-
- [ run custom_format_simple.cpp ]
- [ run html_table_output.cpp ]
- [ run multi_dim_test.cpp ]
-
- [ run is_assoc_iter.cpp ]
- [ run columnated.cpp ]
- ;
-}
+build-project shared//explore_shared_components ;
+build-project print//explore_print ;
+build-project stream//explore_stream ;
\ No newline at end of file
Deleted: sandbox/explore/libs/explore/test/basic_lg_format.hpp
==============================================================================
--- sandbox/explore/libs/explore/test/basic_lg_format.hpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,40 +0,0 @@
-// 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
-
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/list.hpp>
-
-#include "../../../boost/explore/explore.hpp"
-
-struct basic_lg_range_format : explore::basic_range_format
-{
- static char_ *opening() { return "<=";}
- static char_ *closing() { return "=>";}
- static char_ delimiter() { return '#';}
-};
-
-struct basic_lg_range_format_selector
-{
- template< typename T>
- struct range_format
- {
- typedef basic_lg_range_format type;
- };
-};
-
-
-struct basic_lg_format : boost::mpl::list< basic_lg_range_format_selector> {};
-
-// for streaming
-std::ostream& basic_lg_stream_format(std::ostream& ostr)
-{
- using namespace explore;
- return ostr << start("<=") << separator("#") << explore::end("=>")
- << assoc_start("<=") << assoc_separator("#") << assoc_end("=>");
-}
Deleted: sandbox/explore/libs/explore/test/boost_array.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_array.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,148 +0,0 @@
-// 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"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_array_print_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]");
-
- 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 )
-{
- std::stringstream str_out;
-
- boost::array<int,0> ai0;
- str_out << ai0;
- 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]");
-
- str_out.str("");
-
- boost::array<int,3>::iterator itr = ai3.begin() + 2;
-
- str_out << explore::make_iterator_range(ai3.begin(), itr);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-}
-
-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.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]]");
-
- 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 )
-{
- 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.str("");
-
- boost::array<std::vector<int>,3>::iterator itr = av3.begin() + 2;
- str_out << explore::make_iterator_range(av3.begin(), itr);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-}
Deleted: sandbox/explore/libs/explore/test/boost_range.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_range.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,77 +0,0 @@
-// 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/range/iterator_range.hpp>
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( boost_range_print_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- explore::print(boost::make_iterator_range(vi), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- vi.push_back(1);
- explore::print(boost::make_iterator_range(vi), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- vi.push_back(2);
- vi.push_back(3);
- explore::print(boost::make_iterator_range(vi), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- str_out.str("");
- explore::print(boost::make_iterator_range(vi.begin()+2, vi.end()), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[3]");
-
- str_out.str("");
- explore::print(boost::make_iterator_range(vi.rbegin(), vi.rend()), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[3, 2, 1]");
-}
-
-BOOST_AUTO_TEST_CASE( boost_range_stream_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- str_out << explore::make_iterator_range(vi);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- vi.push_back(1);
- str_out << explore::make_iterator_range(vi);
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- vi.push_back(2);
- vi.push_back(3);
- str_out << explore::make_iterator_range(vi);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- str_out.str("");
- str_out << explore::make_iterator_range(vi.begin()+2, vi.end());
- BOOST_CHECK_EQUAL(str_out.str(), "[3]");
-
- str_out.str("");
- str_out << explore::make_iterator_range(vi.rbegin(), vi.rend());
- BOOST_CHECK_EQUAL(str_out.str(), "[3, 2, 1]");
-}
Deleted: sandbox/explore/libs/explore/test/boost_tuple.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_tuple.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,40 +0,0 @@
-// 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/tuple/tuple.hpp>
-#include <boost/tuple/tuple_io.hpp>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_tuple_print_test )
-{
- std::stringstream str_out;
-
- boost::tuples::tuple<int, double> t(1, 3.14);
- explore::print(t, str_out);
-
- // I think things that already have a way to print should not change
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 3.14]");
- BOOST_CHECK_EQUAL(str_out.str(), "(1 3.14)");
-}
-
-BOOST_AUTO_TEST_CASE( basic_tuple_stream_test )
-{
- std::stringstream str_out;
-
- boost::tuples::tuple<int, double> t(1, 3.14);
- str_out << t;
- // I think things that already have a way to print should not change
- //BOOST_CHECK_EQUAL(str_out.str(), "[1, 3.14]");
- BOOST_CHECK_EQUAL(str_out.str(), "(1 3.14)");
-}
Deleted: sandbox/explore/libs/explore/test/boost_variant.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/boost_variant.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,70 +0,0 @@
-// 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/variant.hpp>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_variant_print_test )
-{
- std::stringstream str_out;
-
- boost::variant< int, std::string, std::vector<int> > varVal;
-
- varVal = 1;
- explore::print(varVal, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "1");
-
- str_out.str("");
-
- varVal = std::string("some string");
- explore::print(varVal, 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);
- varVal = vi;
- explore::print(varVal, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-}
-
-BOOST_AUTO_TEST_CASE( basic_variant_stream_test )
-{
- std::stringstream str_out;
-
- boost::variant< int, std::string, std::vector<int> > varVal;
-
- varVal = 1;
- str_out << varVal;
- BOOST_CHECK_EQUAL(str_out.str(), "1");
-
- str_out.str("");
-
- varVal = std::string("some string");
- str_out << varVal;
- 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);
- varVal = vi;
- str_out << varVal;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-}
Deleted: sandbox/explore/libs/explore/test/c_array.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/c_array.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,88 +0,0 @@
-// 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"
-#include "../../../boost/explore/stream_container.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_c_array_print_test )
-{
- std::stringstream str_out;
-
- int arri1[] = {1};
- explore::print(arri1, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- int arri3[] = {1,2,3};
- explore::print(arri3, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-}
-
-BOOST_AUTO_TEST_CASE( basic_c_array_stream_test )
-{
- using namespace explore;
- std::stringstream str_out;
-
- int arri1[] = {1};
- str_out << arri1;
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- int arri3[] = {1,2,3};
- str_out << arri3;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_c_array_print_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- std::vector<int> arrvi1[] = {vi};
- explore::print(arrvi1, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- std::vector<int> arrvi3[] = {vi,vi,vi};
- explore::print(arrvi3, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_c_array_stream_test )
-{
- using namespace explore;
- std::stringstream str_out;
-
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- std::vector<int> arrvi1[] = {vi};
- str_out << arrvi1;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- std::vector<int> arrvi3[] = {vi,vi,vi};
- str_out << arrvi3;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-}
\ No newline at end of file
Deleted: sandbox/explore/libs/explore/test/columnated.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/columnated.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,75 +0,0 @@
-// Boost.Print library
-
-// Copyright Jeffrey Faust 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.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_columnate_print_test )
-{
- //BOOST_FAIL("Test not implemented");
-}
-
-struct columnated_format
-{
- columnated_format(std::size_t rows, std::size_t width) : m_rows(rows), m_width(width) {}
- std::size_t m_rows;
- std::size_t m_width;
-
- friend std::ostream& operator<<(std::ostream& ostr, const columnated_format& f)
- {
- using namespace explore;
- ostr << setrows(f.m_rows) << setitemwidth(f.m_width)
- << separator("") << start("") << explore::end("");
- return ostr;
- }
-};
-
-BOOST_AUTO_TEST_CASE( basic_columnate_stream_test )
-{
- using namespace explore;
- std::stringstream str_out;
- std::vector<int> vi;
-
- for( int i = 0; i < 12; ++i )
- {
- vi.push_back(i);
- }
-
- str_out << setrows(3) << start("") << explore::end("") << vi;
-
- BOOST_CHECK_EQUAL(str_out.str(),
- "0, 1, 2, \n"
- "3, 4, 5, \n"
- "6, 7, 8, \n"
- "9, 10, 11");
-
- str_out.str("");
-
- str_out << setrows(3) << setitemwidth(5) << start("") << explore::end("") << vi;
-
- BOOST_CHECK_EQUAL(str_out.str(),
- " 0, 1, 2, \n"
- " 3, 4, 5, \n"
- " 6, 7, 8, \n"
- " 9, 10, 11");
-
- str_out.str("");
-
- str_out << columnated_format(3, 5) << vi;
-
- BOOST_CHECK_EQUAL(str_out.str(),
- " 0 1 2\n"
- " 3 4 5\n"
- " 6 7 8\n"
- " 9 10 11");
-}
Deleted: sandbox/explore/libs/explore/test/custom_format_simple.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/custom_format_simple.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,150 +0,0 @@
-// 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/range/iterator_range.hpp>
-#include <string>
-#include <sstream>
-#include <vector>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-#include "basic_lg_format.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_vector_custom_format_print_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<==>");
-
- str_out.str("");
-
- vi.push_back(1);
- explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<=1=>");
-
- str_out.str("");
-
- vi.push_back(2);
- vi.push_back(3);
- explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
-
- str_out.str("");
-
- explore::print(vi.begin(), ++(++vi.begin()), str_out, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
-
- str_out.str("");
-
- explore::print(boost::make_iterator_range(vi.begin(), ++(++vi.begin())), str_out, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
-
- str_out.str("");
-
- explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
-}
-
-BOOST_AUTO_TEST_CASE( basic_vector_custom_format_stream_test )
-{
- std::stringstream str_out;
- str_out << basic_lg_stream_format;
-
- std::vector<int> vi;
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "<==>");
-
- str_out.str("");
-
- vi.push_back(1);
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "<=1=>");
-
- str_out.str("");
-
- vi.push_back(2);
- vi.push_back(3);
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(vi.begin(), ++(++vi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
-
- str_out.str("");
-
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
-}
-
-BOOST_AUTO_TEST_CASE( basic_map_custom_format_print_test )
-{
- std::stringstream str_out;
-
- std::map<int,std::string> mis;
- explore::print(mis, str_out, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<==>");
-
- str_out.str("");
-
- mis.insert(std::make_pair(1, "first"));
- explore::print(mis, str_out, basic_lg_format(), explore::default_container_policy());
- 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, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>#<=3#third=>=>");
-
- str_out.str("");
-
- explore::print(mis.begin(), ++(++mis.begin()), str_out, basic_lg_format(), explore::default_container_policy());
- 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, basic_lg_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>=>");
-}
-
-BOOST_AUTO_TEST_CASE( basic_map_custom_format_stream_test )
-{
- std::stringstream str_out;
- str_out << basic_lg_stream_format;
-
- std::map<int,std::string> mis;
- str_out << mis;
- BOOST_CHECK_EQUAL(str_out.str(), "<==>");
-
- str_out.str("");
-
- mis.insert(std::make_pair(1, "first"));
- str_out << mis;
- 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"));
-
- str_out << mis;
- BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>#<=3#third=>=>");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(mis.begin(), ++(++mis.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>=>");
-}
Deleted: sandbox/explore/libs/explore/test/html_table_output.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/html_table_output.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,92 +0,0 @@
-// Boost.Print library
-
-// Copyright Danny Havenith 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"
-#include "../../../boost/explore/html_table_format.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-
-BOOST_AUTO_TEST_CASE( vector_in_c_array_html_print_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- std::vector<int> arrvi1[] = {vi};
- explore::print(arrvi1, str_out, explore::html_table_format(), explore::default_container_policy());
-
- BOOST_CHECK_EQUAL(str_out.str(),
- "<table>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "</table>\n");
-
- str_out.str("");
-
- std::vector<int> arrvi3[] = {vi,vi,vi};
- explore::print(arrvi3, str_out, explore::html_table_format(), explore::default_container_policy());
- BOOST_CHECK_EQUAL(str_out.str(),
- "<table>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "</table>\n");
-}
-
-std::ostream& html_table_stream_format(std::ostream& ostr)
-{
- using namespace explore;
- ostr << start("<table>\n")
- << separator("")
- << explore::end("</table>\n");
-
- ostr << start("<tr><td>", 1)
- << separator("</td><td>", 1)
- << explore::end("</td></tr>\n", 1);
-
- return ostr;
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_c_array_html_stream_test )
-{
- using namespace explore;
- std::stringstream str_out;
- str_out << html_table_stream_format;
-
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- std::vector<int> arrvi1[] = {vi};
- str_out << arrvi1;
-
- BOOST_CHECK_EQUAL(str_out.str(),
- "<table>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "</table>\n");
-
- str_out.str("");
-
- std::vector<int> arrvi3[] = {vi,vi,vi};
- str_out << arrvi3;
- BOOST_CHECK_EQUAL(str_out.str(),
- "<table>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
- "</table>\n");
-}
-
Deleted: sandbox/explore/libs/explore/test/is_assoc_iter.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/is_assoc_iter.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,39 +0,0 @@
-// Boost.Print library
-
-// Copyright Jeffrey Faust 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 <map>
-#include <list>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/is_assoc_iter.hpp"
-
-BOOST_AUTO_TEST_CASE( is_assoc_iter_test )
-{
- bool mapHasAssocIter = explore::is_assoc_iter<std::map<int, double>::iterator>::type();
- BOOST_CHECK(mapHasAssocIter);
-
- bool multimapHasAssocIter = explore::is_assoc_iter<std::multimap<std::string, bool>::iterator>::type();
- BOOST_CHECK(multimapHasAssocIter);
-
- bool vectorHasAssocIter = explore::is_assoc_iter<std::vector<double>::iterator>::type();
- BOOST_CHECK(!vectorHasAssocIter);
-
- bool pointerHasAssocIter = explore::is_assoc_iter<int*>::type();
- BOOST_CHECK(!pointerHasAssocIter);
-
- bool pairHasAssocIter = explore::is_assoc_iter<std::pair<int, double> >::type();
- BOOST_CHECK(!pairHasAssocIter);
-
- bool listOfPairHasAssocIter = explore::is_assoc_iter<std::list<std::pair<int, double> >::iterator >::type();
- BOOST_CHECK(!listOfPairHasAssocIter);
-}
Deleted: sandbox/explore/libs/explore/test/multi_dim_test.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/multi_dim_test.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,161 +0,0 @@
-// Boost.Print library
-
-// Copyright Jeffrey Faust 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"
-#include "../../../boost/explore/stream_container.hpp"
-
-BOOST_AUTO_TEST_CASE( two_dimension_print_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- std::vector<std::vector<int> > vvi;
-
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- vvi.push_back(vi);
- vvi.push_back(vi);
- vvi.push_back(vi);
-
- explore::print(vvi, str_out/*, ??? */);
- BOOST_CHECK_EQUAL(str_out.str(),
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|");
-}
-
-std::ostream& format_2d(std::ostream& ostr)
-{
- using namespace explore;
-
- // level 0
- ostr << start("") << explore::end("") << separator("\n");
-
- // level 1
- ostr << start("|", 1) << explore::end("|", 1) << separator(" ", 1);
-
- return ostr;
-}
-
-BOOST_AUTO_TEST_CASE( two_dimension_stream_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- std::vector<std::vector<int> > vvi;
-
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- vvi.push_back(vi);
- vvi.push_back(vi);
- vvi.push_back(vi);
-
- str_out << format_2d << vvi;
- BOOST_CHECK_EQUAL(str_out.str(),
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|");
-}
-
-BOOST_AUTO_TEST_CASE( three_dimension_print_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- std::vector<std::vector<int> > vvi;
- std::vector<std::vector<std::vector<int> > > vvvi;
-
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- vvi.push_back(vi);
- vvi.push_back(vi);
- vvi.push_back(vi);
-
- vvvi.push_back(vvi);
- vvvi.push_back(vvi);
- vvvi.push_back(vvi);
-
- explore::print(vvvi, str_out/*, ??? */);
- BOOST_CHECK_EQUAL(str_out.str(),
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|"
- );
-}
-
-std::ostream& format_3d(std::ostream& ostr)
-{
- using namespace explore;
-
- // level 0
- ostr << start("") << explore::end("") << separator("\n\n");
-
- // level 1
- ostr << start("", 1) << explore::end("", 1) << separator("\n", 1);
-
- // level 2
- ostr << start("|", 2) << explore::end("|", 2) << separator(" ", 2);
-
- return ostr;
-}
-
-BOOST_AUTO_TEST_CASE( three_dimension_stream_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- std::vector<std::vector<int> > vvi;
- std::vector<std::vector<std::vector<int> > > vvvi;
-
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- vvi.push_back(vi);
- vvi.push_back(vi);
- vvi.push_back(vi);
-
- vvvi.push_back(vvi);
- vvvi.push_back(vvi);
- vvvi.push_back(vvi);
-
- str_out << format_3d << vvvi;
- BOOST_CHECK_EQUAL(str_out.str(),
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "\n"
- "|1 2 3|\n"
- "|1 2 3|\n"
- "|1 2 3|"
- );
-}
Added: sandbox/explore/libs/explore/test/print/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/Jamfile.v2 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,43 @@
+# Boost.Explore 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
+ ;
+{
+ test-suite explore_print
+ :
+ [ run simple_types.cpp ]
+ [ run c_array.cpp ]
+ [ run user_defined_container.cpp ]
+
+ [ run std_vector.cpp ]
+ [ run std_deque.cpp ]
+ [ run std_list.cpp ]
+ [ run std_map.cpp ]
+ [ run std_set.cpp ]
+ [ run std_pair.cpp ]
+
+ [ run boost_array.cpp ]
+ [ run boost_tuple.cpp ]
+ [ run boost_variant.cpp ]
+
+ [ run boost_range.cpp ]
+
+ [ run custom_format_simple.cpp ]
+ [ run html_table_output.cpp ]
+ [ run multi_dim_test.cpp ]
+
+ [ run columnated.cpp ]
+ ;
+}
Copied: sandbox/explore/libs/explore/test/print/basic_lg_format.hpp (from r38410, /sandbox/explore/libs/explore/test/basic_lg_format.hpp)
==============================================================================
--- /sandbox/explore/libs/explore/test/basic_lg_format.hpp (original)
+++ sandbox/explore/libs/explore/test/print/basic_lg_format.hpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -1,4 +1,4 @@
-// Boost.Print library
+// Boost.Explore library
// Copyright Jared McIntyre 2007. Use, modification and
// distribution is subject to the Boost Software License, Version
@@ -10,7 +10,7 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/list.hpp>
-#include "../../../boost/explore/explore.hpp"
+#include <boost/explore.hpp>
struct basic_lg_range_format : explore::basic_range_format
{
@@ -28,13 +28,4 @@
};
};
-
-struct basic_lg_format : boost::mpl::list< basic_lg_range_format_selector> {};
-
-// for streaming
-std::ostream& basic_lg_stream_format(std::ostream& ostr)
-{
- using namespace explore;
- return ostr << start("<=") << separator("#") << explore::end("=>")
- << assoc_start("<=") << assoc_separator("#") << assoc_end("=>");
-}
+struct basic_lg_format : boost::mpl::list< basic_lg_range_format_selector> {};
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/boost_array.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/boost_array.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,86 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_array_print_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]");
+
+ 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 )
+{
+ 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]]");
+
+ 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]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/boost_range.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/boost_range.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,45 @@
+// Boost.Explore 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/range/iterator_range.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( boost_range_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ explore::print(boost::make_iterator_range(vi), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ vi.push_back(1);
+ explore::print(boost::make_iterator_range(vi), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ vi.push_back(2);
+ vi.push_back(3);
+ explore::print(boost::make_iterator_range(vi), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+
+ str_out.str("");
+ explore::print(boost::make_iterator_range(vi.begin()+2, vi.end()), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[3]");
+
+ str_out.str("");
+ explore::print(boost::make_iterator_range(vi.rbegin(), vi.rend()), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[3, 2, 1]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/boost_tuple.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/boost_tuple.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,28 @@
+// Boost.Explore 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/tuple/tuple.hpp>
+#include <boost/tuple/tuple_io.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_tuple_print_test )
+{
+ std::stringstream str_out;
+
+ boost::tuples::tuple<int, double> t(1, 3.14);
+ explore::print(t, str_out);
+
+ // I think things that already have a way to print should not change
+ //BOOST_CHECK_EQUAL(str_out.str(), "[1, 3.14]");
+ BOOST_CHECK_EQUAL(str_out.str(), "(1 3.14)");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/boost_variant.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/boost_variant.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,42 @@
+// Boost.Explore 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/variant.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_variant_print_test )
+{
+ std::stringstream str_out;
+
+ boost::variant< int, std::string, std::vector<int> > varVal;
+
+ varVal = 1;
+ explore::print(varVal, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "1");
+
+ str_out.str("");
+
+ varVal = std::string("some string");
+ explore::print(varVal, 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);
+ varVal = vi;
+ explore::print(varVal, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/c_array.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/c_array.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,50 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_c_array_print_test )
+{
+ std::stringstream str_out;
+
+ int arri1[] = {1};
+ explore::print(arri1, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ int arri3[] = {1,2,3};
+ explore::print(arri3, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_c_array_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::vector<int> arrvi1[] = {vi};
+ explore::print(arrvi1, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ std::vector<int> arrvi3[] = {vi,vi,vi};
+ explore::print(arrvi3, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/columnated.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/columnated.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,35 @@
+// Boost.Explore library
+
+// Copyright Jeffrey Faust 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_columnate_print_test )
+{
+ //BOOST_FAIL("Test not implemented");
+}
+
+struct columnated_format
+{
+ columnated_format(std::size_t rows, std::size_t width) : m_rows(rows), m_width(width) {}
+ std::size_t m_rows;
+ std::size_t m_width;
+
+ friend std::ostream& operator<<(std::ostream& ostr, const columnated_format& f)
+ {
+ using namespace explore;
+ ostr << setrows(f.m_rows) << setitemwidth(f.m_width)
+ << separator("") << start("") << explore::end("");
+ return ostr;
+ }
+};
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/custom_format_simple.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/custom_format_simple.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,86 @@
+// Boost.Explore 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/range/iterator_range.hpp>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <boost/explore.hpp>
+#include "basic_lg_format.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_vector_custom_format_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<==>");
+
+ str_out.str("");
+
+ vi.push_back(1);
+ explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1=>");
+
+ str_out.str("");
+
+ vi.push_back(2);
+ vi.push_back(3);
+ explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
+
+ str_out.str("");
+
+ explore::print(vi.begin(), ++(++vi.begin()), str_out, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
+
+ str_out.str("");
+
+ explore::print(boost::make_iterator_range(vi.begin(), ++(++vi.begin())), str_out, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
+
+ str_out.str("");
+
+ explore::print(vi, str_out, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
+}
+
+BOOST_AUTO_TEST_CASE( basic_map_custom_format_print_test )
+{
+ std::stringstream str_out;
+
+ std::map<int,std::string> mis;
+ explore::print(mis, str_out, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<==>");
+
+ str_out.str("");
+
+ mis.insert(std::make_pair(1, "first"));
+ explore::print(mis, str_out, basic_lg_format(), explore::default_container_policy());
+ 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, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>#<=3#third=>=>");
+
+ str_out.str("");
+
+ explore::print(mis.begin(), ++(++mis.begin()), str_out, basic_lg_format(), explore::default_container_policy());
+ 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, basic_lg_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>=>");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/html_table_output.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/html_table_output.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,45 @@
+// Boost.Explore library
+
+// Copyright Danny Havenith 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.hpp>
+#include <boost/explore/html_table_format.hpp>
+
+BOOST_AUTO_TEST_CASE( vector_in_c_array_html_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::vector<int> arrvi1[] = {vi};
+ explore::print(arrvi1, str_out, explore::html_table_format(), explore::default_container_policy());
+
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "<table>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "</table>\n");
+
+ str_out.str("");
+
+ std::vector<int> arrvi3[] = {vi,vi,vi};
+ explore::print(arrvi3, str_out, explore::html_table_format(), explore::default_container_policy());
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "<table>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "</table>\n");
+}
Added: sandbox/explore/libs/explore/test/print/multi_dim_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/multi_dim_test.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,73 @@
+// Boost.Explore library
+
+// Copyright Jeffrey Faust 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.hpp>
+
+BOOST_AUTO_TEST_CASE( two_dimension_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ std::vector<std::vector<int> > vvi;
+
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+
+ explore::print(vvi, str_out/*, ??? */);
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|");
+}
+
+BOOST_AUTO_TEST_CASE( three_dimension_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ std::vector<std::vector<int> > vvi;
+ std::vector<std::vector<std::vector<int> > > vvvi;
+
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+
+ vvvi.push_back(vvi);
+ vvvi.push_back(vvi);
+ vvvi.push_back(vvi);
+
+ explore::print(vvvi, str_out/*, ??? */);
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|"
+ );
+}
Added: sandbox/explore/libs/explore/test/print/simple_types.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/simple_types.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,123 @@
+// Boost.Explore 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 <iomanip>
+#include <boost/lexical_cast.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( int_print_test )
+{
+ std::stringstream str_out;
+ int i = 123;
+
+ explore::print(i, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "123");
+
+ str_out.str("");
+
+ int* pi = NULL;
+ explore::print(pi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "null");
+
+ str_out.str("");
+
+ //pi = &i;
+ //explore::print(pi, str_out);
+ // technically, we should force this to be true, though
+ // it is highly unlikely to be false. Otherwise this test is only
+ // telling you whether the following is even valid.
+ //BOOST_CHECK(0 != boost::lexical_cast<std::string>((long)pi).compare("123"));
+
+ // this is not a useful test. pointers should print out as pointers.
+ //BOOST_CHECK_EQUAL(str_out.str(), "123");
+}
+
+BOOST_AUTO_TEST_CASE( float_print_test )
+{
+ std::stringstream str_out;
+ float f = 1.234f;
+
+ explore::print(f, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "1.234");
+
+ // are these needed?
+ //BOOST_CHECK_MESSAGE(false, "Test min precision");
+ //BOOST_CHECK_MESSAGE(false, "Test max precision");
+}
+
+BOOST_AUTO_TEST_CASE( double_print_test )
+{
+ std::stringstream str_out;
+ double d = 1.2341234f;
+
+ str_out << std::setprecision(7);
+ explore::print(d, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "1.234123");
+
+ // are these needed?
+ //BOOST_CHECK_MESSAGE(false, "Test min precision");
+ //BOOST_CHECK_MESSAGE(false, "Test max precision");
+}
+
+BOOST_AUTO_TEST_CASE( bool_print_test )
+{
+ std::stringstream str_out;
+ bool b = true;
+
+ str_out << std::boolalpha;
+ explore::print(b, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "true");
+
+ str_out.str("");
+ b = false;
+
+ explore::print(b, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "false");
+}
+
+BOOST_AUTO_TEST_CASE( char_print_test )
+{
+ std::stringstream str_out;
+ char c = 'c';
+
+ explore::print(c, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "c");
+
+ str_out.str("");
+
+ char* pc = NULL;
+ explore::print(pc, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "null");
+
+ str_out.str("");
+
+ pc = "c";
+ explore::print(pc, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "c");
+
+ str_out.str("");
+
+ pc = "cat";
+ explore::print(pc, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "cat");
+}
+
+BOOST_AUTO_TEST_CASE( string_print_test )
+{
+ std::stringstream str_out;
+ std::string s = "some string";
+
+ explore::print(s, str_out);
+
+ BOOST_CHECK_EQUAL(str_out.str(), "some string");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/std_deque.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/std_deque.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,84 @@
+// Boost.Explore 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 <deque>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_deque_print_test )
+{
+ std::stringstream str_out;
+
+ std::deque<int> di;
+ explore::print(di, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ di.push_back(1);
+ explore::print(di, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ di.push_back(2);
+ 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( deque_in_deque_print_test )
+{
+ std::stringstream str_out;
+
+ std::deque<int> di;
+ di.push_back(1);
+ di.push_back(2);
+ di.push_back(3);
+
+ std::deque<std::deque<int> > ddi;
+ explore::print(ddi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ ddi.push_back(di);
+ explore::print(ddi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ 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]]");
+
+ 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]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/std_list.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/std_list.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,85 @@
+// Boost.Explore 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 <list>
+#include <complex>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_list_print_test )
+{
+ std::stringstream str_out;
+
+ std::list<std::complex<double> > lc;
+ explore::print(lc, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ lc.push_back(std::complex<double>(0,1));
+ explore::print(lc, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[(0,1)]");
+
+ str_out.str("");
+
+ 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)]");
+
+ 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 )
+{
+ std::stringstream str_out;
+
+ std::list<int> li;
+ li.push_back(1);
+ li.push_back(2);
+ li.push_back(3);
+
+ std::list<std::list<int> > lli;
+ explore::print(lli, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ lli.push_back(li);
+ explore::print(lli, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ 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]]");
+
+ 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]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/std_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/std_map.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,124 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_map_print_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]");
+
+ 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(explore::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 )
+{
+ 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]");
+
+ str_out.str("");
+
+ 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]");
+
+ 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(explore::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 )
+{
+ 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]]");
+
+ 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(explore::make_iterator_range(mivi.begin(), ++(++mivi.begin())), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/std_pair.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/std_pair.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,60 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_pair_print_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_print_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]]");
+
+ str_out.str("");
+
+ explore::print(vpi.begin(), ++(++vpi.begin()), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2]]");
+
+ str_out.str("");
+
+ explore::print(boost::make_iterator_range(vpi.begin(), ++(++vpi.begin())), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2]]");
+}
Added: sandbox/explore/libs/explore/test/print/std_set.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/std_set.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,123 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_set_print_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]");
+
+ 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 )
+{
+ 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]");
+
+ str_out.str("");
+
+ 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]");
+
+ 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 )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::multiset<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]]");
+
+ 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]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/std_vector.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/std_vector.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,102 @@
+// Boost.Explore 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/range/iterator_range.hpp>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( vector_custom_format_print_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]");
+
+ str_out.str("");
+
+ explore::print(vi.begin(), ++(++vi.begin()), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+
+ str_out.str("");
+
+ explore::print(boost::make_iterator_range(vi.begin(), ++(++vi.begin())), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+
+ str_out.str("");
+
+ explore::print(vi, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_vector_print_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]]");
+
+ str_out.str("");
+
+ explore::print(vvi.begin(), ++(++vvi.begin()), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+
+ str_out.str("");
+
+ explore::print(boost::make_iterator_range(vvi.begin(), ++(++vvi.begin())), str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[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]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/print/user_defined_container.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/print/user_defined_container.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,53 @@
+// Boost.Explore 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.hpp>
+
+class user_vector
+{
+public:
+ user_vector()
+ {
+ m_vec.push_back(1);
+ m_vec.push_back(2);
+ m_vec.push_back(3);
+ }
+
+ std::vector<int>::const_iterator start() const
+ {
+ return m_vec.begin();
+ }
+
+ std::vector<int>::const_iterator finish() const
+ {
+ return m_vec.end();
+ }
+
+private:
+ std::vector<int> m_vec;
+};
+
+std::ostream& operator<<(std::ostream& ostr, const user_vector& u)
+{
+ return explore::stream_container(ostr, u.start(), u.finish());
+}
+
+BOOST_AUTO_TEST_CASE( user_defined_print_test )
+{
+ std::stringstream str_out;
+
+ user_vector v;
+ explore::print(v, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
Added: sandbox/explore/libs/explore/test/shared/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/shared/Jamfile.v2 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,22 @@
+# Boost.Explore 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
+ ;
+{
+ test-suite explore_shared_components
+ :
+ [ run is_assoc_iter.cpp ]
+ ;
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/shared/is_assoc_iter.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/shared/is_assoc_iter.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,38 @@
+// Boost.Print library
+
+// Copyright Jeffrey Faust 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 <map>
+#include <list>
+#include <boost/explore.hpp>
+#include <boost/explore/is_assoc_iter.hpp>
+
+BOOST_AUTO_TEST_CASE( is_assoc_iter_test )
+{
+ bool mapHasAssocIter = explore::is_assoc_iter<std::map<int, double>::iterator>::type();
+ BOOST_CHECK(mapHasAssocIter);
+
+ bool multimapHasAssocIter = explore::is_assoc_iter<std::multimap<std::string, bool>::iterator>::type();
+ BOOST_CHECK(multimapHasAssocIter);
+
+ bool vectorHasAssocIter = explore::is_assoc_iter<std::vector<double>::iterator>::type();
+ BOOST_CHECK(!vectorHasAssocIter);
+
+ bool pointerHasAssocIter = explore::is_assoc_iter<int*>::type();
+ BOOST_CHECK(!pointerHasAssocIter);
+
+ bool pairHasAssocIter = explore::is_assoc_iter<std::pair<int, double> >::type();
+ BOOST_CHECK(!pairHasAssocIter);
+
+ bool listOfPairHasAssocIter = explore::is_assoc_iter<std::list<std::pair<int, double> >::iterator >::type();
+ BOOST_CHECK(!listOfPairHasAssocIter);
+}
Deleted: sandbox/explore/libs/explore/test/simple_types.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/simple_types.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,207 +0,0 @@
-// 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 <iomanip>
-#include <boost/lexical_cast.hpp>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-
-BOOST_AUTO_TEST_CASE( int_print_test )
-{
- std::stringstream str_out;
- int i = 123;
-
- explore::print(i, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "123");
-
- str_out.str("");
-
- int* pi = NULL;
- explore::print(pi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "null");
-
- str_out.str("");
-
- //pi = &i;
- //explore::print(pi, str_out);
- // technically, we should force this to be true, though
- // it is highly unlikely to be false. Otherwise this test is only
- // telling you whether the following is even valid.
- //BOOST_CHECK(0 != boost::lexical_cast<std::string>((long)pi).compare("123"));
-
- // this is not a useful test. pointers should print out as pointers.
- //BOOST_CHECK_EQUAL(str_out.str(), "123");
-}
-
-BOOST_AUTO_TEST_CASE( int_stream_test )
-{
- std::stringstream str_out;
- int i = 123;
-
- str_out << i;
- BOOST_CHECK_EQUAL(str_out.str(), "123");
-
- str_out.str("");
- int* pi = &i;
-
- str_out << pi;
- // technically, we should force this to be true, though
- // it is highly unlikely to be false. Otherwise this test is only
- // telling you whether the following is even valid.
- //BOOST_CHECK(0 != boost::lexical_cast<std::string>((long)pi).compare("123"));
- //BOOST_CHECK_EQUAL(str_out.str(), "123");
-}
-
-BOOST_AUTO_TEST_CASE( float_print_test )
-{
- std::stringstream str_out;
- float f = 1.234f;
-
- explore::print(f, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "1.234");
-
- // are these needed?
- //BOOST_CHECK_MESSAGE(false, "Test min precision");
- //BOOST_CHECK_MESSAGE(false, "Test max precision");
-}
-
-BOOST_AUTO_TEST_CASE( float_stream_test )
-{
- std::stringstream str_out;
- float f = 1.234f;
-
- str_out << std::setprecision(4) << f;
- BOOST_CHECK_EQUAL(str_out.str(), "1.234");
-
- //BOOST_CHECK_MESSAGE(false, "Test min precision");
- //BOOST_CHECK_MESSAGE(false, "Test max precision");
-}
-
-BOOST_AUTO_TEST_CASE( double_print_test )
-{
- std::stringstream str_out;
- double d = 1.2341234f;
-
- str_out << std::setprecision(7);
- explore::print(d, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "1.234123");
-
- // are these needed?
- //BOOST_CHECK_MESSAGE(false, "Test min precision");
- //BOOST_CHECK_MESSAGE(false, "Test max precision");
-}
-
-BOOST_AUTO_TEST_CASE( double_stream_test )
-{
- std::stringstream str_out;
- double d = 1.2341234f;
-
- str_out << std::setprecision(7) << d;
- BOOST_CHECK_EQUAL(str_out.str(), "1.234123");
-
- //BOOST_CHECK_MESSAGE(false, "Test min precision");
- //BOOST_CHECK_MESSAGE(false, "Test max precision");
-}
-
-BOOST_AUTO_TEST_CASE( bool_print_test )
-{
- std::stringstream str_out;
- bool b = true;
-
- str_out << std::boolalpha;
- explore::print(b, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "true");
-
- str_out.str("");
- b = false;
-
- explore::print(b, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "false");
-}
-
-BOOST_AUTO_TEST_CASE( bool_stream_test )
-{
- std::stringstream str_out;
- bool b = true;
-
- str_out << std::boolalpha << b;
- BOOST_CHECK_EQUAL(str_out.str(), "true");
-
- str_out.str("");
- b = false;
-
- str_out << std::boolalpha << b;
- BOOST_CHECK_EQUAL(str_out.str(), "false");
-}
-
-BOOST_AUTO_TEST_CASE( char_print_test )
-{
- std::stringstream str_out;
- char c = 'c';
-
- explore::print(c, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "c");
-
- str_out.str("");
-
- char* pc = NULL;
- explore::print(pc, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "null");
-
- str_out.str("");
-
- pc = "c";
- explore::print(pc, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "c");
-
- str_out.str("");
-
- pc = "cat";
- explore::print(pc, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "cat");
-}
-
-BOOST_AUTO_TEST_CASE( char_stream_test )
-{
- std::stringstream str_out;
- char c = 'c';
-
- str_out << c;
- BOOST_CHECK_EQUAL(str_out.str(), "c");
-
- str_out.str("");
- char* pc = "c";
-
- str_out << pc;
- BOOST_CHECK_EQUAL(str_out.str(), "c");
-}
-
-BOOST_AUTO_TEST_CASE( string_print_test )
-{
- std::stringstream str_out;
- std::string s = "some string";
-
- explore::print(s, str_out);
-
- BOOST_CHECK_EQUAL(str_out.str(), "some string");
-}
-
-BOOST_AUTO_TEST_CASE( string_stream_test )
-{
- std::stringstream str_out;
- std::string s = "some string";
-
- str_out << s;
-
- BOOST_CHECK_EQUAL(str_out.str(), "some string");
-}
Deleted: sandbox/explore/libs/explore/test/std_deque.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_deque.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,145 +0,0 @@
-// 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 <deque>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_deque_print_test )
-{
- std::stringstream str_out;
-
- std::deque<int> di;
- explore::print(di, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- di.push_back(1);
- explore::print(di, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- di.push_back(2);
- 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 )
-{
- std::stringstream str_out;
-
- std::deque<int> di;
- str_out << di;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- di.push_back(1);
- str_out << di;
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- di.push_back(2);
- di.push_back(3);
- str_out << di;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(di.begin(), ++(++di.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-}
-
-BOOST_AUTO_TEST_CASE( deque_in_deque_print_test )
-{
- std::stringstream str_out;
-
- std::deque<int> di;
- di.push_back(1);
- di.push_back(2);
- di.push_back(3);
-
- std::deque<std::deque<int> > ddi;
- explore::print(ddi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- ddi.push_back(di);
- explore::print(ddi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- 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]]");
-
- 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 )
-{
- std::stringstream str_out;
-
- std::deque<int> di;
- di.push_back(1);
- di.push_back(2);
- di.push_back(3);
-
- std::deque<std::deque<int> > ddi;
- str_out << ddi;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- ddi.push_back(di);
- str_out << ddi;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- 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]]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(ddi.begin(), ++(++ddi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-}
Deleted: sandbox/explore/libs/explore/test/std_list.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_list.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,146 +0,0 @@
-// 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 <list>
-#include <complex>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_list_print_test )
-{
- std::stringstream str_out;
-
- std::list<std::complex<double> > lc;
- explore::print(lc, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- lc.push_back(std::complex<double>(0,1));
- explore::print(lc, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[(0,1)]");
-
- str_out.str("");
-
- 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)]");
-
- 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 )
-{
- std::stringstream str_out;
-
- std::list<std::complex<double> > lc;
- str_out << lc;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- lc.push_back(std::complex<double>(0,1));
- str_out << lc;
- BOOST_CHECK_EQUAL(str_out.str(), "[(0,1)]");
-
- str_out.str("");
-
- 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)]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(lc.begin(), ++(++lc.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3)]");
-}
-
-BOOST_AUTO_TEST_CASE( list_in_list_print_test )
-{
- std::stringstream str_out;
-
- std::list<int> li;
- li.push_back(1);
- li.push_back(2);
- li.push_back(3);
-
- std::list<std::list<int> > lli;
- explore::print(lli, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- lli.push_back(li);
- explore::print(lli, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- 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]]");
-
- 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 )
-{
- std::stringstream str_out;
-
- std::list<int> li;
- li.push_back(1);
- li.push_back(2);
- li.push_back(3);
-
- std::list<std::list<int> > lli;
- str_out << lli;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- lli.push_back(li);
- str_out << lli;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- 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]]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(lli.begin(), ++(++lli.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-}
Deleted: sandbox/explore/libs/explore/test/std_map.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_map.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,219 +0,0 @@
-// 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"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_map_print_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]");
-
- 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(explore::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 )
-{
- std::stringstream str_out;
-
- std::map<int,std::string> mis;
- str_out << mis;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- mis.insert(std::make_pair(1, "first"));
- str_out << mis;
- 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"));
- str_out << mis;
- BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(mis.begin(), ++(++mis.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second]");
-}
-
-BOOST_AUTO_TEST_CASE( basic_multimap_print_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]");
-
- str_out.str("");
-
- 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]");
-
- 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(explore::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 )
-{
- std::stringstream str_out;
-
- std::multimap<int,std::string> mmis;
- str_out << mmis;;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- mmis.insert(std::make_pair(1, "first"));
- str_out << mmis;
- BOOST_CHECK_EQUAL(str_out.str(), "[1:first]");
-
- str_out.str("");
-
- mmis.insert(std::make_pair(1, "single"));
- str_out << mmis;
- 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"));
- str_out << mmis;
- BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single, 2:second, 3:third, 3:triple]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(mmis.begin(), ++(++mmis.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_map_print_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]]");
-
- 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(explore::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 )
-{
- 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;
- str_out << mivi;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- mivi.insert(std::make_pair(1, vi));
- str_out << mivi;
- 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));
- str_out << mivi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3], 3:[1, 2, 3]]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(mivi.begin(), ++(++mivi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
-}
Deleted: sandbox/explore/libs/explore/test/std_pair.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_pair.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,100 +0,0 @@
-// 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"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_pair_print_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]");
-}
-
-BOOST_AUTO_TEST_CASE( basic_pair_stream_test )
-{
- std::stringstream str_out;
-
- std::pair<int,int> pi = std::make_pair(1,2);
- str_out << pi;
- 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_print_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]]");
-
- str_out.str("");
-
- explore::print(vpi.begin(), ++(++vpi.begin()), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2]]");
-
- str_out.str("");
-
- explore::print(boost::make_iterator_range(vpi.begin(), ++(++vpi.begin())), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2]]");
-}
-
-BOOST_AUTO_TEST_CASE( pair_in_vector_stream_test )
-{
- std::stringstream str_out;
-
- std::vector<std::pair<int,int> > vpi;
- str_out << vpi;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- std::pair<int,int> pi = std::make_pair(1,2);
-
- vpi.push_back(pi);
- str_out << vpi;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2]]");
-
- str_out.str("");
-
- vpi.push_back(pi);
- vpi.push_back(pi);
- str_out << vpi;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2], [1, 2]]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(vpi.begin(), ++(++vpi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2]]");
-}
Deleted: sandbox/explore/libs/explore/test/std_set.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_set.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,218 +0,0 @@
-// 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"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( basic_set_print_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]");
-
- 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 )
-{
- std::stringstream str_out;
-
- std::set<int> si;
- str_out << si;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- si.insert(1);
- str_out << si;
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- si.insert(2);
- si.insert(3);
- str_out << si;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(si.begin(), ++(++si.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-}
-
-BOOST_AUTO_TEST_CASE( basic_multiset_print_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]");
-
- str_out.str("");
-
- 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]");
-
- 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 )
-{
- std::stringstream str_out;
-
- std::multiset<int> msi;
- str_out << msi;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- msi.insert(1);
- str_out << msi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- msi.insert(1);
- str_out << msi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
-
- str_out.str("");
-
- msi.insert(2);
- msi.insert(3);
- msi.insert(3);
- str_out << msi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 1, 2, 3, 3]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(msi.begin(), ++(++msi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_set_print_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- std::multiset<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]]");
-
- 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 )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- vi.push_back(1);
- vi.push_back(2);
- vi.push_back(3);
-
- std::multiset<std::vector<int> > svi;
- str_out << svi;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- svi.insert(vi);
- str_out << svi;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
-
- str_out.str("");
-
- svi.insert(vi);
- svi.insert(vi);
- str_out << svi;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(svi.begin(), ++(++svi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-}
Deleted: sandbox/explore/libs/explore/test/std_vector.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/std_vector.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,173 +0,0 @@
-// 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/range/iterator_range.hpp>
-#include <string>
-#include <sstream>
-#include <vector>
-#include "../../../boost/explore/explore.hpp"
-#include "../../../boost/explore/stream_container.hpp"
-#include "../../../boost/explore/iterator_range.hpp"
-
-BOOST_AUTO_TEST_CASE( vector_custom_format_print_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]");
-
- str_out.str("");
-
- explore::print(vi.begin(), ++(++vi.begin()), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
- str_out.str("");
-
- explore::print(boost::make_iterator_range(vi.begin(), ++(++vi.begin())), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-
- str_out.str("");
-
- explore::print(vi, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-}
-
-BOOST_AUTO_TEST_CASE( basic_vector_stream_test )
-{
- std::stringstream str_out;
-
- std::vector<int> vi;
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- vi.push_back(1);
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1]");
-
- str_out.str("");
-
- vi.push_back(2);
- vi.push_back(3);
- str_out << vi;
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(vi.begin(), ++(++vi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_vector_print_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]]");
-
- str_out.str("");
-
- explore::print(vvi.begin(), ++(++vvi.begin()), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-
- str_out.str("");
-
- explore::print(boost::make_iterator_range(vvi.begin(), ++(++vvi.begin())), str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
-}
-
-BOOST_AUTO_TEST_CASE( vector_in_vector_stream_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;
- str_out << vvi;
- BOOST_CHECK_EQUAL(str_out.str(), "[]");
-
- str_out.str("");
-
- vvi.push_back(vi);
- str_out << vvi;
- 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]]");
-
- str_out.str("");
-
- str_out << explore::make_iterator_range(vvi.begin(), ++(++vvi.begin()));
- BOOST_CHECK_EQUAL(str_out.str(), "[[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 )
-{
- std::stringstream str_out;
-
- std::vector<std::string> vs;
- vs.push_back("[1, 2, 3], [1, 2, 3], [1, 2, 3]");
- str_out << vs;
- BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
-}
Added: sandbox/explore/libs/explore/test/stream/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/Jamfile.v2 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,43 @@
+# Boost.Explore 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
+ ;
+{
+ test-suite explore_stream
+ :
+ [ run simple_types.cpp ]
+ [ run c_array.cpp ]
+ [ run user_defined_container.cpp ]
+
+ [ run std_vector.cpp ]
+ [ run std_deque.cpp ]
+ [ run std_list.cpp ]
+ [ run std_map.cpp ]
+ [ run std_set.cpp ]
+ [ run std_pair.cpp ]
+
+ [ run boost_array.cpp ]
+ [ run boost_tuple.cpp ]
+ [ run boost_variant.cpp ]
+
+ [ run boost_range.cpp ]
+
+ [ run custom_format_simple.cpp ]
+ [ run html_table_output.cpp ]
+ [ run multi_dim_test.cpp ]
+
+ [ run columnated.cpp ]
+ ;
+}
Copied: sandbox/explore/libs/explore/test/stream/basic_lg_format.hpp (from r38410, /sandbox/explore/libs/explore/test/basic_lg_format.hpp)
==============================================================================
--- /sandbox/explore/libs/explore/test/basic_lg_format.hpp (original)
+++ sandbox/explore/libs/explore/test/stream/basic_lg_format.hpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -1,4 +1,4 @@
-// Boost.Print library
+// Boost.Explore library
// Copyright Jared McIntyre 2007. Use, modification and
// distribution is subject to the Boost Software License, Version
@@ -10,26 +10,7 @@
#include <boost/mpl/if.hpp>
#include <boost/mpl/list.hpp>
-#include "../../../boost/explore/explore.hpp"
-
-struct basic_lg_range_format : explore::basic_range_format
-{
- static char_ *opening() { return "<=";}
- static char_ *closing() { return "=>";}
- static char_ delimiter() { return '#';}
-};
-
-struct basic_lg_range_format_selector
-{
- template< typename T>
- struct range_format
- {
- typedef basic_lg_range_format type;
- };
-};
-
-
-struct basic_lg_format : boost::mpl::list< basic_lg_range_format_selector> {};
+#include <boost/explore.hpp>
// for streaming
std::ostream& basic_lg_stream_format(std::ostream& ostr)
Added: sandbox/explore/libs/explore/test/stream/boost_array.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/boost_array.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,75 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_array_stream_test )
+{
+ std::stringstream str_out;
+
+ boost::array<int,0> ai0;
+ str_out << ai0;
+ 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]");
+
+ str_out.str("");
+
+ boost::array<int,3>::iterator itr = ai3.begin() + 2;
+
+ str_out << explore::make_iterator_range(ai3.begin(), itr);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_array_stream_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;
+ 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.str("");
+
+ boost::array<std::vector<int>,3>::iterator itr = av3.begin() + 2;
+ str_out << explore::make_iterator_range(av3.begin(), itr);
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+}
Added: sandbox/explore/libs/explore/test/stream/boost_range.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/boost_range.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,45 @@
+// Boost.Explore 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/range/iterator_range.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( boost_range_stream_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ str_out << explore::make_iterator_range(vi);
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ vi.push_back(1);
+ str_out << explore::make_iterator_range(vi);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ vi.push_back(2);
+ vi.push_back(3);
+ str_out << explore::make_iterator_range(vi);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+
+ str_out.str("");
+ str_out << explore::make_iterator_range(vi.begin()+2, vi.end());
+ BOOST_CHECK_EQUAL(str_out.str(), "[3]");
+
+ str_out.str("");
+ str_out << explore::make_iterator_range(vi.rbegin(), vi.rend());
+ BOOST_CHECK_EQUAL(str_out.str(), "[3, 2, 1]");
+}
Added: sandbox/explore/libs/explore/test/stream/boost_tuple.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/boost_tuple.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,27 @@
+// Boost.Explore 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/tuple/tuple.hpp>
+#include <boost/tuple/tuple_io.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_tuple_stream_test )
+{
+ std::stringstream str_out;
+
+ boost::tuples::tuple<int, double> t(1, 3.14);
+ str_out << t;
+ // I think things that already have a way to print should not change
+ //BOOST_CHECK_EQUAL(str_out.str(), "[1, 3.14]");
+ BOOST_CHECK_EQUAL(str_out.str(), "(1 3.14)");
+}
Added: sandbox/explore/libs/explore/test/stream/boost_variant.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/boost_variant.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,42 @@
+// Boost.Explore 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/variant.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_variant_stream_test )
+{
+ std::stringstream str_out;
+
+ boost::variant< int, std::string, std::vector<int> > varVal;
+
+ varVal = 1;
+ str_out << varVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "1");
+
+ str_out.str("");
+
+ varVal = std::string("some string");
+ str_out << varVal;
+ 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);
+ varVal = vi;
+ str_out << varVal;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
Added: sandbox/explore/libs/explore/test/stream/c_array.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/c_array.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,52 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_c_array_stream_test )
+{
+ using namespace explore;
+ std::stringstream str_out;
+
+ int arri1[] = {1};
+ str_out << arri1;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ int arri3[] = {1,2,3};
+ str_out << arri3;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_c_array_stream_test )
+{
+ using namespace explore;
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::vector<int> arrvi1[] = {vi};
+ str_out << arrvi1;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ std::vector<int> arrvi3[] = {vi,vi,vi};
+ str_out << arrvi3;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/stream/columnated.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/columnated.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,70 @@
+// Boost.Explore library
+
+// Copyright Jeffrey Faust 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.hpp>
+
+struct columnated_format
+{
+ columnated_format(std::size_t rows, std::size_t width) : m_rows(rows), m_width(width) {}
+ std::size_t m_rows;
+ std::size_t m_width;
+
+ friend std::ostream& operator<<(std::ostream& ostr, const columnated_format& f)
+ {
+ using namespace explore;
+ ostr << setrows(f.m_rows) << setitemwidth(f.m_width)
+ << separator("") << start("") << explore::end("");
+ return ostr;
+ }
+};
+
+BOOST_AUTO_TEST_CASE( basic_columnate_stream_test )
+{
+ using namespace explore;
+ std::stringstream str_out;
+ std::vector<int> vi;
+
+ for( int i = 0; i < 12; ++i )
+ {
+ vi.push_back(i);
+ }
+
+ str_out << setrows(3) << start("") << explore::end("") << vi;
+
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "0, 1, 2, \n"
+ "3, 4, 5, \n"
+ "6, 7, 8, \n"
+ "9, 10, 11");
+
+ str_out.str("");
+
+ str_out << setrows(3) << setitemwidth(5) << start("") << explore::end("") << vi;
+
+ BOOST_CHECK_EQUAL(str_out.str(),
+ " 0, 1, 2, \n"
+ " 3, 4, 5, \n"
+ " 6, 7, 8, \n"
+ " 9, 10, 11");
+
+ str_out.str("");
+
+ str_out << columnated_format(3, 5) << vi;
+
+ BOOST_CHECK_EQUAL(str_out.str(),
+ " 0 1 2\n"
+ " 3 4 5\n"
+ " 6 7 8\n"
+ " 9 10 11");
+}
Added: sandbox/explore/libs/explore/test/stream/custom_format_simple.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/custom_format_simple.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,79 @@
+// Boost.Explore 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/range/iterator_range.hpp>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <boost/explore.hpp>
+#include "basic_lg_format.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_vector_custom_format_stream_test )
+{
+ std::stringstream str_out;
+ str_out << basic_lg_stream_format;
+
+ std::vector<int> vi;
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "<==>");
+
+ str_out.str("");
+
+ vi.push_back(1);
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1=>");
+
+ str_out.str("");
+
+ vi.push_back(2);
+ vi.push_back(3);
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(vi.begin(), ++(++vi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2=>");
+
+ str_out.str("");
+
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "<=1#2#3=>");
+}
+
+BOOST_AUTO_TEST_CASE( basic_map_custom_format_stream_test )
+{
+ std::stringstream str_out;
+ str_out << basic_lg_stream_format;
+
+ std::map<int,std::string> mis;
+ str_out << mis;
+ BOOST_CHECK_EQUAL(str_out.str(), "<==>");
+
+ str_out.str("");
+
+ mis.insert(std::make_pair(1, "first"));
+ str_out << mis;
+ 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"));
+
+ str_out << mis;
+ BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>#<=3#third=>=>");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(mis.begin(), ++(++mis.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "<=<=1#first=>#<=2#second=>=>");
+}
Added: sandbox/explore/libs/explore/test/stream/html_table_output.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/html_table_output.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,61 @@
+// Boost.Explore library
+
+// Copyright Danny Havenith 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.hpp>
+
+std::ostream& html_table_stream_format(std::ostream& ostr)
+{
+ using namespace explore;
+ ostr << start("<table>\n")
+ << separator("")
+ << explore::end("</table>\n");
+
+ ostr << start("<tr><td>", 1)
+ << separator("</td><td>", 1)
+ << explore::end("</td></tr>\n", 1);
+
+ return ostr;
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_c_array_html_stream_test )
+{
+ using namespace explore;
+ std::stringstream str_out;
+ str_out << html_table_stream_format;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::vector<int> arrvi1[] = {vi};
+ str_out << arrvi1;
+
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "<table>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "</table>\n");
+
+ str_out.str("");
+
+ std::vector<int> arrvi3[] = {vi,vi,vi};
+ str_out << arrvi3;
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "<table>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "<tr><td>1</td><td>2</td><td>3</td></tr>\n"
+ "</table>\n");
+}
+
Added: sandbox/explore/libs/explore/test/stream/multi_dim_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/multi_dim_test.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,160 @@
+// Boost.Explore library
+
+// Copyright Jeffrey Faust 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.hpp>
+
+BOOST_AUTO_TEST_CASE( two_dimension_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ std::vector<std::vector<int> > vvi;
+
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+
+ explore::print(vvi, str_out/*, ??? */);
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|");
+}
+
+std::ostream& format_2d(std::ostream& ostr)
+{
+ using namespace explore;
+
+ // level 0
+ ostr << start("") << explore::end("") << separator("\n");
+
+ // level 1
+ ostr << start("|", 1) << explore::end("|", 1) << separator(" ", 1);
+
+ return ostr;
+}
+
+BOOST_AUTO_TEST_CASE( two_dimension_stream_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ std::vector<std::vector<int> > vvi;
+
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+
+ str_out << format_2d << vvi;
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|");
+}
+
+BOOST_AUTO_TEST_CASE( three_dimension_print_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ std::vector<std::vector<int> > vvi;
+ std::vector<std::vector<std::vector<int> > > vvvi;
+
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+
+ vvvi.push_back(vvi);
+ vvvi.push_back(vvi);
+ vvvi.push_back(vvi);
+
+ explore::print(vvvi, str_out/*, ??? */);
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|"
+ );
+}
+
+std::ostream& format_3d(std::ostream& ostr)
+{
+ using namespace explore;
+
+ // level 0
+ ostr << start("") << explore::end("") << separator("\n\n");
+
+ // level 1
+ ostr << start("", 1) << explore::end("", 1) << separator("\n", 1);
+
+ // level 2
+ ostr << start("|", 2) << explore::end("|", 2) << separator(" ", 2);
+
+ return ostr;
+}
+
+BOOST_AUTO_TEST_CASE( three_dimension_stream_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ std::vector<std::vector<int> > vvi;
+ std::vector<std::vector<std::vector<int> > > vvvi;
+
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+ vvi.push_back(vi);
+
+ vvvi.push_back(vvi);
+ vvvi.push_back(vvi);
+ vvvi.push_back(vvi);
+
+ str_out << format_3d << vvvi;
+ BOOST_CHECK_EQUAL(str_out.str(),
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "\n"
+ "|1 2 3|\n"
+ "|1 2 3|\n"
+ "|1 2 3|"
+ );
+}
Added: sandbox/explore/libs/explore/test/stream/simple_types.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/simple_types.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,99 @@
+// Boost.Explore 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 <iomanip>
+#include <boost/lexical_cast.hpp>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( int_stream_test )
+{
+ std::stringstream str_out;
+ int i = 123;
+
+ str_out << i;
+ BOOST_CHECK_EQUAL(str_out.str(), "123");
+
+ str_out.str("");
+ int* pi = &i;
+
+ str_out << pi;
+ // technically, we should force this to be true, though
+ // it is highly unlikely to be false. Otherwise this test is only
+ // telling you whether the following is even valid.
+ //BOOST_CHECK(0 != boost::lexical_cast<std::string>((long)pi).compare("123"));
+ //BOOST_CHECK_EQUAL(str_out.str(), "123");
+}
+
+BOOST_AUTO_TEST_CASE( float_stream_test )
+{
+ std::stringstream str_out;
+ float f = 1.234f;
+
+ str_out << std::setprecision(4) << f;
+ BOOST_CHECK_EQUAL(str_out.str(), "1.234");
+
+ //BOOST_CHECK_MESSAGE(false, "Test min precision");
+ //BOOST_CHECK_MESSAGE(false, "Test max precision");
+}
+
+BOOST_AUTO_TEST_CASE( double_stream_test )
+{
+ std::stringstream str_out;
+ double d = 1.2341234f;
+
+ str_out << std::setprecision(7) << d;
+ BOOST_CHECK_EQUAL(str_out.str(), "1.234123");
+
+ //BOOST_CHECK_MESSAGE(false, "Test min precision");
+ //BOOST_CHECK_MESSAGE(false, "Test max precision");
+}
+
+BOOST_AUTO_TEST_CASE( bool_stream_test )
+{
+ std::stringstream str_out;
+ bool b = true;
+
+ str_out << std::boolalpha << b;
+ BOOST_CHECK_EQUAL(str_out.str(), "true");
+
+ str_out.str("");
+ b = false;
+
+ str_out << std::boolalpha << b;
+ BOOST_CHECK_EQUAL(str_out.str(), "false");
+}
+
+BOOST_AUTO_TEST_CASE( char_stream_test )
+{
+ std::stringstream str_out;
+ char c = 'c';
+
+ str_out << c;
+ BOOST_CHECK_EQUAL(str_out.str(), "c");
+
+ str_out.str("");
+ char* pc = "c";
+
+ str_out << pc;
+ BOOST_CHECK_EQUAL(str_out.str(), "c");
+}
+
+BOOST_AUTO_TEST_CASE( string_stream_test )
+{
+ std::stringstream str_out;
+ std::string s = "some string";
+
+ str_out << s;
+
+ BOOST_CHECK_EQUAL(str_out.str(), "some string");
+}
Added: sandbox/explore/libs/explore/test/stream/std_deque.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/std_deque.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,74 @@
+// Boost.Explore 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 <deque>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_deque_stream_test )
+{
+ std::stringstream str_out;
+
+ std::deque<int> di;
+ str_out << di;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ di.push_back(1);
+ str_out << di;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ di.push_back(2);
+ di.push_back(3);
+ str_out << di;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(di.begin(), ++(++di.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+}
+
+BOOST_AUTO_TEST_CASE( deque_in_deque_stream_test )
+{
+ std::stringstream str_out;
+
+ std::deque<int> di;
+ di.push_back(1);
+ di.push_back(2);
+ di.push_back(3);
+
+ std::deque<std::deque<int> > ddi;
+ str_out << ddi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ ddi.push_back(di);
+ str_out << ddi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ 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]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(ddi.begin(), ++(++ddi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+}
Added: sandbox/explore/libs/explore/test/stream/std_list.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/std_list.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,75 @@
+// Boost.Explore 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 <list>
+#include <complex>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_list_stream_test )
+{
+ std::stringstream str_out;
+
+ std::list<std::complex<double> > lc;
+ str_out << lc;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ lc.push_back(std::complex<double>(0,1));
+ str_out << lc;
+ BOOST_CHECK_EQUAL(str_out.str(), "[(0,1)]");
+
+ str_out.str("");
+
+ 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)]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(lc.begin(), ++(++lc.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[(0,1), (2,3)]");
+}
+
+BOOST_AUTO_TEST_CASE( list_in_list_stream_test )
+{
+ std::stringstream str_out;
+
+ std::list<int> li;
+ li.push_back(1);
+ li.push_back(2);
+ li.push_back(3);
+
+ std::list<std::list<int> > lli;
+ str_out << lli;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ lli.push_back(li);
+ str_out << lli;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ 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]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(lli.begin(), ++(++lli.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+}
Added: sandbox/explore/libs/explore/test/stream/std_map.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/std_map.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,109 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_map_stream_test )
+{
+ std::stringstream str_out;
+
+ std::map<int,std::string> mis;
+ str_out << mis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mis.insert(std::make_pair(1, "first"));
+ str_out << mis;
+ 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"));
+ str_out << mis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second, 3:third]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(mis.begin(), ++(++mis.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 2:second]");
+}
+
+BOOST_AUTO_TEST_CASE( basic_multimap_stream_test )
+{
+ std::stringstream str_out;
+
+ std::multimap<int,std::string> mmis;
+ str_out << mmis;;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mmis.insert(std::make_pair(1, "first"));
+ str_out << mmis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first]");
+
+ str_out.str("");
+
+ mmis.insert(std::make_pair(1, "single"));
+ str_out << mmis;
+ 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"));
+ str_out << mmis;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single, 2:second, 3:third, 3:triple]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(mmis.begin(), ++(++mmis.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:first, 1:single]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_map_stream_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;
+ str_out << mivi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ mivi.insert(std::make_pair(1, vi));
+ str_out << mivi;
+ 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));
+ str_out << mivi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3], 3:[1, 2, 3]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(mivi.begin(), ++(++mivi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1:[1, 2, 3], 2:[1, 2, 3]]");
+}
Added: sandbox/explore/libs/explore/test/stream/std_pair.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/std_pair.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,52 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_pair_stream_test )
+{
+ std::stringstream str_out;
+
+ std::pair<int,int> pi = std::make_pair(1,2);
+ str_out << pi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+}
+
+BOOST_AUTO_TEST_CASE( pair_in_vector_stream_test )
+{
+ std::stringstream str_out;
+
+ std::vector<std::pair<int,int> > vpi;
+ str_out << vpi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ std::pair<int,int> pi = std::make_pair(1,2);
+
+ vpi.push_back(pi);
+ str_out << vpi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2]]");
+
+ str_out.str("");
+
+ vpi.push_back(pi);
+ vpi.push_back(pi);
+ str_out << vpi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2], [1, 2]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(vpi.begin(), ++(++vpi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2], [1, 2]]");
+}
Added: sandbox/explore/libs/explore/test/stream/std_set.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/std_set.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,108 @@
+// Boost.Explore 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.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_set_stream_test )
+{
+ std::stringstream str_out;
+
+ std::set<int> si;
+ str_out << si;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ si.insert(1);
+ str_out << si;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ si.insert(2);
+ si.insert(3);
+ str_out << si;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(si.begin(), ++(++si.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+}
+
+BOOST_AUTO_TEST_CASE( basic_multiset_stream_test )
+{
+ std::stringstream str_out;
+
+ std::multiset<int> msi;
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ msi.insert(1);
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ msi.insert(1);
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
+
+ str_out.str("");
+
+ msi.insert(2);
+ msi.insert(3);
+ msi.insert(3);
+ str_out << msi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1, 2, 3, 3]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(msi.begin(), ++(++msi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 1]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_set_stream_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ vi.push_back(1);
+ vi.push_back(2);
+ vi.push_back(3);
+
+ std::multiset<std::vector<int> > svi;
+ str_out << svi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ svi.insert(vi);
+ str_out << svi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3]]");
+
+ str_out.str("");
+
+ svi.insert(vi);
+ svi.insert(vi);
+ str_out << svi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(svi.begin(), ++(++svi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+}
Added: sandbox/explore/libs/explore/test/stream/std_vector.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/std_vector.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,85 @@
+// Boost.Explore 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/range/iterator_range.hpp>
+#include <string>
+#include <sstream>
+#include <vector>
+#include <boost/explore.hpp>
+
+BOOST_AUTO_TEST_CASE( basic_vector_stream_test )
+{
+ std::stringstream str_out;
+
+ std::vector<int> vi;
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ vi.push_back(1);
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1]");
+
+ str_out.str("");
+
+ vi.push_back(2);
+ vi.push_back(3);
+ str_out << vi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(vi.begin(), ++(++vi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_in_vector_stream_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;
+ str_out << vvi;
+ BOOST_CHECK_EQUAL(str_out.str(), "[]");
+
+ str_out.str("");
+
+ vvi.push_back(vi);
+ str_out << vvi;
+ 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]]");
+
+ str_out.str("");
+
+ str_out << explore::make_iterator_range(vvi.begin(), ++(++vvi.begin()));
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3]]");
+}
+
+BOOST_AUTO_TEST_CASE( vector_with_ugly_string_case_stream_test )
+{
+ std::stringstream str_out;
+
+ std::vector<std::string> vs;
+ vs.push_back("[1, 2, 3], [1, 2, 3], [1, 2, 3]");
+ str_out << vs;
+ BOOST_CHECK_EQUAL(str_out.str(), "[[1, 2, 3], [1, 2, 3], [1, 2, 3]]");
+}
Added: sandbox/explore/libs/explore/test/stream/user_defined_container.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/stream/user_defined_container.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
@@ -0,0 +1,53 @@
+// Boost.Explore 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.hpp>
+
+class user_vector
+{
+public:
+ user_vector()
+ {
+ m_vec.push_back(1);
+ m_vec.push_back(2);
+ m_vec.push_back(3);
+ }
+
+ std::vector<int>::const_iterator start() const
+ {
+ return m_vec.begin();
+ }
+
+ std::vector<int>::const_iterator finish() const
+ {
+ return m_vec.end();
+ }
+
+private:
+ std::vector<int> m_vec;
+};
+
+std::ostream& operator<<(std::ostream& ostr, const user_vector& u)
+{
+ return explore::stream_container(ostr, u.start(), u.finish());
+}
+
+BOOST_AUTO_TEST_CASE( user_defined_stream_test )
+{
+ std::stringstream str_out;
+
+ user_vector v;
+ str_out << v;
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
+}
+
Deleted: sandbox/explore/libs/explore/test/user_defined_container.cpp
==============================================================================
--- sandbox/explore/libs/explore/test/user_defined_container.cpp 2007-08-03 01:28:26 EDT (Fri, 03 Aug 2007)
+++ (empty file)
@@ -1,63 +0,0 @@
-// 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"
-#include "../../../boost/explore/stream_container.hpp"
-
-class user_vector
-{
-public:
- user_vector()
- {
- m_vec.push_back(1);
- m_vec.push_back(2);
- m_vec.push_back(3);
- }
-
- std::vector<int>::const_iterator start() const
- {
- return m_vec.begin();
- }
-
- std::vector<int>::const_iterator finish() const
- {
- return m_vec.end();
- }
-
-private:
- std::vector<int> m_vec;
-};
-
-std::ostream& operator<<(std::ostream& ostr, const user_vector& u)
-{
- return explore::stream_container(ostr, u.start(), u.finish());
-}
-
-BOOST_AUTO_TEST_CASE( user_defined_print_test )
-{
- std::stringstream str_out;
-
- user_vector v;
- explore::print(v, str_out);
- BOOST_CHECK_EQUAL(str_out.str(), "[1, 2, 3]");
-}
-
-BOOST_AUTO_TEST_CASE( user_defined_stream_test )
-{
- std::stringstream str_out;
-
- user_vector v;
- str_out << v;
- 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