|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71940 - sandbox/conversion/libs/conversion_ext/test
From: vicente.botet_at_[hidden]
Date: 2011-05-14 14:00:34
Author: viboes
Date: 2011-05-14 14:00:33 EDT (Sat, 14 May 2011)
New Revision: 71940
URL: http://svn.boost.org/trac/boost/changeset/71940
Log:
Conversion: Added string + convert_to functor tests
Added:
sandbox/conversion/libs/conversion_ext/test/string.cpp (contents, props changed)
Text files modified:
sandbox/conversion/libs/conversion_ext/test/builtins.cpp | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
Modified: sandbox/conversion/libs/conversion_ext/test/builtins.cpp
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/builtins.cpp (original)
+++ sandbox/conversion/libs/conversion_ext/test/builtins.cpp 2011-05-14 14:00:33 EDT (Sat, 14 May 2011)
@@ -13,6 +13,8 @@
#include <boost/conversion/ca_wrapper.hpp>
#include <boost/conversion/convert_to.hpp>
#include <boost/conversion/include.hpp>
+#include <boost/conversion/fp/convert_to.hpp>
+#include <boost/phoenix/core/argument.hpp>
//using namespace boost;
@@ -181,6 +183,21 @@
}
}
+void fp_convert_to() {
+ {
+ char c=0;
+ short s=1;
+ int i=2;
+ long l=3;
+
+ using boost::phoenix::placeholders::_1;
+
+ c=boost::conversion::fp::convert_to<char>(-1)(l) ;
+
+ }
+}
+
+
int main( )
{
convert_to_with_builtin_types();
@@ -188,6 +205,7 @@
mca_assign_to_with_builtin_types();
assign_to_transitive();
mca_assign_to_transitive();
+ fp_convert_to();
return boost::report_errors();
}
Added: sandbox/conversion/libs/conversion_ext/test/string.cpp
==============================================================================
--- (empty file)
+++ sandbox/conversion/libs/conversion_ext/test/string.cpp 2011-05-14 14:00:33 EDT (Sat, 14 May 2011)
@@ -0,0 +1,42 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/assign_to.hpp>
+#include <boost/conversion/std/string.hpp>
+#include <iostream>
+#include <boost/detail/lightweight_test.hpp>
+
+using namespace boost;
+
+typedef int A1;
+typedef short B1;
+
+void explicit_convert_to() {
+ bool b1=true;
+ std::string str = boost::convert_to<std::string>(b1);
+ bool b2=boost::convert_to<bool>(str);
+
+}
+void explicit_assign_to() {
+ bool b1=true;
+ std::string str;
+ boost::assign_to(str, b1);
+ bool b2;
+ boost::assign_to(b2, str);
+}
+
+int main( )
+{
+ explicit_convert_to();
+ explicit_assign_to();
+ return boost::report_errors();
+}
+
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