|
Boost-Commit : |
From: jared_at_[hidden]
Date: 2007-05-21 21:42:51
Author: jared
Date: 2007-05-21 21:42:50 EDT (Mon, 21 May 2007)
New Revision: 4166
URL: http://svn.boost.org/trac/boost/changeset/4166
Log:
Added tuple and variant tests.
Added:
sandbox/explore/libs/explore/test/boost_tuple.cpp
sandbox/explore/libs/explore/test/boost_variant.cpp
Text files modified:
sandbox/explore/libs/explore/test/Jamfile.v2 | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Modified: sandbox/explore/libs/explore/test/Jamfile.v2
==============================================================================
--- sandbox/explore/libs/explore/test/Jamfile.v2 (original)
+++ sandbox/explore/libs/explore/test/Jamfile.v2 2007-05-21 21:42:50 EDT (Mon, 21 May 2007)
@@ -29,6 +29,7 @@
[ run boost_array.cpp ]
[ run boost_any.cpp ]
+ [ run boost_tuple.cpp ]
;
}
Added: sandbox/explore/libs/explore/test/boost_tuple.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/boost_tuple.cpp 2007-05-21 21:42:50 EDT (Mon, 21 May 2007)
@@ -0,0 +1,24 @@
+// 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/explore/explore.hpp"
+
+BOOST_AUTO_TEST_CASE( basic_tuple_test )
+{
+ std::stringstream str_out;
+
+ boost::tuple<int, double> t(1, 3.14);
+ explore::print(t, str_out);
+ BOOST_CHECK_EQUAL(str_out.str(), "[1, 3.14]");
+}
\ No newline at end of file
Added: sandbox/explore/libs/explore/test/boost_variant.cpp
==============================================================================
--- (empty file)
+++ sandbox/explore/libs/explore/test/boost_variant.cpp 2007-05-21 21:42:50 EDT (Mon, 21 May 2007)
@@ -0,0 +1,42 @@
+// 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"
+
+BOOST_AUTO_TEST_CASE( basic_variant_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:first, 2:second, 3:third]");
+}
\ No newline at end of file
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