Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72873 - sandbox/coerce/libs/coerce/test
From: vexocide_at_[hidden]
Date: 2011-07-03 10:11:23


Author: vexocide
Date: 2011-07-03 10:11:23 EDT (Sun, 03 Jul 2011)
New Revision: 72873
URL: http://svn.boost.org/trac/boost/changeset/72873

Log:
Added tests for the karma backend
Added:
   sandbox/coerce/libs/coerce/test/karma.cpp (contents, props changed)
Text files modified:
   sandbox/coerce/libs/coerce/test/Jamfile.v2 | 3 +++
   sandbox/coerce/libs/coerce/test/qi.cpp | 4 +++-
   2 files changed, 6 insertions(+), 1 deletions(-)

Modified: sandbox/coerce/libs/coerce/test/Jamfile.v2
==============================================================================
--- sandbox/coerce/libs/coerce/test/Jamfile.v2 (original)
+++ sandbox/coerce/libs/coerce/test/Jamfile.v2 2011-07-03 10:11:23 EDT (Sun, 03 Jul 2011)
@@ -13,5 +13,8 @@
 unit-test integral :
     integral.cpp ;
 
+unit-test karma :
+ karma.cpp ;
+
 unit-test qi :
     qi.cpp ;

Added: sandbox/coerce/libs/coerce/test/karma.cpp
==============================================================================
--- (empty file)
+++ sandbox/coerce/libs/coerce/test/karma.cpp 2011-07-03 10:11:23 EDT (Sun, 03 Jul 2011)
@@ -0,0 +1,29 @@
+// Copyright Jeroen Habraken 2011.
+//
+// Distributed under 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)
+
+#define BOOST_TEST_MODULE karma
+
+#include <boost/coerce.hpp>
+#include <boost/test/unit_test.hpp>
+
+#include <string>
+#include <vector>
+
+BOOST_TEST_DONT_PRINT_LOG_VALUE(std::wstring);
+BOOST_TEST_DONT_PRINT_LOG_VALUE(std::vector<char>);
+BOOST_TEST_DONT_PRINT_LOG_VALUE(std::vector<wchar_t>);
+
+BOOST_AUTO_TEST_CASE(qi) {
+ using namespace boost;
+
+ BOOST_CHECK_EQUAL(coerce::as<std::string>(1), std::string("1"));
+ BOOST_CHECK_EQUAL(coerce::as<std::wstring>(1), std::wstring(L"1"));
+
+ std::vector<char> vector_char(1, '1');
+ BOOST_CHECK_EQUAL(coerce::as<std::vector<char> >(1), vector_char);
+ std::vector<wchar_t> vector_wchar_t(1, L'1');
+ BOOST_CHECK_EQUAL(coerce::as<std::vector<wchar_t> >(1), vector_wchar_t);
+}

Modified: sandbox/coerce/libs/coerce/test/qi.cpp
==============================================================================
--- sandbox/coerce/libs/coerce/test/qi.cpp (original)
+++ sandbox/coerce/libs/coerce/test/qi.cpp 2011-07-03 10:11:23 EDT (Sun, 03 Jul 2011)
@@ -9,9 +9,11 @@
 #include <boost/coerce.hpp>
 #include <boost/test/unit_test.hpp>
 
+#include <string>
+
 BOOST_AUTO_TEST_CASE(qi) {
     using namespace boost;
-
+
     char char_extent[1] = {'1'};
     BOOST_CHECK_EQUAL(coerce::as<int>(char_extent), 1);
     wchar_t wchar_t_extent[1] = {'1'};


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