Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71906 - sandbox/conversion/libs/conversion_ext/test
From: vicente.botet_at_[hidden]
Date: 2011-05-12 16:34:29


Author: viboes
Date: 2011-05-12 16:34:28 EDT (Thu, 12 May 2011)
New Revision: 71906
URL: http://svn.boost.org/trac/boost/changeset/71906

Log:
Added some tests using the new functions discusses on the ML
Text files modified:
   sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 | 1
   sandbox/conversion/libs/conversion_ext/test/builtins.cpp | 1
   sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp | 4 +-
   sandbox/conversion/libs/conversion_ext/test/optional.cpp | 56 ++++++++++++++++++++++-----------------
   4 files changed, 35 insertions(+), 27 deletions(-)

Modified: sandbox/conversion/libs/conversion_ext/test/Jamfile.v2
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 (original)
+++ sandbox/conversion/libs/conversion_ext/test/Jamfile.v2 2011-05-12 16:34:28 EDT (Thu, 12 May 2011)
@@ -51,6 +51,7 @@
      [ run extrinsec.cpp ]
      [ run pair.cpp ]
      [ run complex.cpp ]
+ [ run string.cpp ]
      [ run vector.cpp ]
      [ run interval.cpp ]
      [ run rational.cpp ]

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-12 16:34:28 EDT (Thu, 12 May 2011)
@@ -12,6 +12,7 @@
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/conversion/ca_wrapper.hpp>
 #include <boost/conversion/convert_to.hpp>
+#include <boost/conversion/include.hpp>
 
 //using namespace boost;
 

Modified: sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp (original)
+++ sandbox/conversion/libs/conversion_ext/test/extrinsec.cpp 2011-05-12 16:34:28 EDT (Thu, 12 May 2011)
@@ -58,8 +58,8 @@
 
 }
 void implicit_conversion_via_mca() {
- B b;
- f(mca(b));
+ C c;
+ f(mca(c));
 }
 int main( )
 {

Modified: sandbox/conversion/libs/conversion_ext/test/optional.cpp
==============================================================================
--- sandbox/conversion/libs/conversion_ext/test/optional.cpp (original)
+++ sandbox/conversion/libs/conversion_ext/test/optional.cpp 2011-05-12 16:34:28 EDT (Thu, 12 May 2011)
@@ -15,35 +15,41 @@
 
 using namespace boost;
 
- struct A1{};
- struct B1{};
- A1 convert_to(const B1&, boost::dummy::type_tag<A1> const&) {
- return A1();
- }
-
- A1& assign_to(A1& to, const B1&) {
- return to;
- }
-
-
-void explicit_convert_to() {
- B1 b1;
- boost::optional<B1> b;
- boost::optional<A1> a1(boost::convert_to<boost::optional<A1> >(b));
- //optional<A1> a1;
- //a1=convert_to<optional<A1> >(b);
- boost::optional<A1> a2(boost::convert_to<boost::optional<A1> >(boost::optional<B1>(b1)));
+struct A1{};
+struct B1{};
+A1 convert_to(const B1&, boost::dummy::type_tag<A1> const&)
+{
+ return A1();
+}
 
+A1& assign_to(A1& to, const B1&)
+{
+ return to;
 }
-void explicit_assign_to() {
- B1 b1;
- boost::optional<A1> a;
- boost::optional<B1> b;
- //assign_to(b,a);
- boost::assign_to(a, boost::optional<B1>(b1));
+
+
+void explicit_convert_to()
+{
+ B1 b1;
+ boost::optional<B1> b;
+ boost::optional<A1> a1(boost::convert_to<boost::optional<A1> >(b));
+ optional<A1> a3;
+ a3=convert_to<optional<A1> >(b);
+ a3=convert_to<optional<A1> >(b1);
+ boost::optional<A1> a2(boost::convert_to<boost::optional<A1> >(boost::optional<B1>(b1)));
+
+}
+
+void explicit_assign_to()
+{
+ B1 b1;
+ boost::optional<A1> a;
+ boost::optional<B1> b;
+ //assign_to(b,a);
+ boost::assign_to(a, boost::optional<B1>(b1));
 }
 
-int main( )
+int main()
 {
   explicit_convert_to();
   explicit_assign_to();


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