Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68500 - in sandbox/assign_v2/libs/assign/v2/test/put/pipe: . csv functor
From: erwann.rogard_at_[hidden]
Date: 2011-01-27 18:27:37


Author: e_r
Date: 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
New Revision: 68500
URL: http://svn.boost.org/trac/boost/changeset/68500

Log:
upd assign_v2
Added:
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/container.cpp (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/container.h (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/rhs.cpp (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/rhs.h (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/functor/rhs.cpp (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/functor/rhs.h (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo.cpp (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo.h (contents, props changed)

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/container.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/container.cpp 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,37 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#include <list>
+#include <boost/assign/v2/detail/checking/check.hpp>
+#include <boost/assign/v2/put/pipe/csv.hpp>
+#include <libs/assign/v2/test/put/pipe/functor/container.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_csv{
+namespace xxx_container{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ //[csv_pipe_list
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::list<T> seq;
+ seq | as2::_csv_put( x, y, z );
+ BOOST_ASSIGN_V2_CHECK( seq.front() == x );
+ BOOST_ASSIGN_V2_CHECK( seq.back() == z );
+ //]
+ }
+
+}// xxx_container
+}// xxx_csv
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/container.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/container.h 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,27 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef LIBS_ASSIGN_V2_TEST_PUT_PIPE_CSV_CONTAINER_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_CSV_CONTAINER_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_csv{
+namespace xxx_container{
+
+ void test();
+
+}// xxx_container
+}// xxx_csv
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/rhs.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/rhs.cpp 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,76 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#include <iostream>
+#include <boost/preprocessor/expr_if.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/assign/v2/detail/checking/equal.hpp>
+#include <boost/assign/v2/put/pipe/csv.hpp>
+
+#include <libs/assign/v2/test/put/pipe/csv/rhs.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_csv{
+namespace xxx_rhs{
+
+ template<int i, typename T, typename P, typename U>
+ void xxx_assert(T& rhs, P const& pred, U const& u)
+ {
+ // TODO name lookup?
+ using namespace boost;
+ using namespace boost::assign::v2;
+
+ pred( rhs.seq_args()[ i ].get(), u );
+ }
+
+ void test(){
+
+ namespace as2 = boost::assign::v2;
+ typedef boost::mpl::int_<0> zero_;
+ typedef int const cint_;
+ cint_ x = -1, y = 0, z = 1;
+ int x1 = x + 5, y1 = y + 5, z1 = z + 5;
+
+ namespace chk = as2::checking;
+ typedef chk::equal_ref r_;
+ typedef chk::equal_val v_;
+
+ {
+ BOOST_AUTO( rhs, ( as2::_csv_put( x1, y1, z1 ) ) );
+ xxx_assert<0>(rhs, r_(), x1);
+ xxx_assert<1>(rhs, r_(), y1);
+ xxx_assert<2>(rhs, r_(), z1);
+ }
+ {
+ BOOST_AUTO( rhs, ( as2::_csv_put( x1, y1, z ) ) );
+ xxx_assert<0>(rhs, r_(), x1);
+ xxx_assert<1>(rhs, r_(), y1);
+ xxx_assert<2>(rhs, r_(), z);
+ }
+#define Z -10
+ {
+ BOOST_AUTO( rhs, ( as2::_csv_put( x1, y, Z ) ) );
+ xxx_assert<0>(rhs, r_(), x1);
+ xxx_assert<1>(rhs, r_(), y);
+ xxx_assert<2>(rhs, v_(), Z);
+ }
+
+#undef Z
+
+ }
+
+}// xxx_rhs
+}// xxx_csv
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/rhs.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/csv/rhs.h 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,27 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef LIBS_ASSIGN_V2_TEST_PUT_PIPE_CSV_RHS_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_CSV_RHS_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_csv{
+namespace xxx_rhs{
+
+ void test();
+
+}// xxx_rhs
+}// xxx_csv
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/functor/rhs.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/functor/rhs.cpp 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,112 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#include <string>
+#include <boost/mpl/int.hpp>
+#include <boost/typeof/typeof.hpp>
+#include <boost/assign/v2/detail/checking/equal.hpp>
+#include <boost/assign/v2/detail/checking/constants.hpp>
+#include <boost/assign/v2/put/ext/repeat.hpp>
+#include <boost/assign/v2/put/pipe/functor.hpp>
+#include <libs/assign/v2/test/put/pipe/functor/rhs.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_functor{
+namespace xxx_rhs{
+
+ template<int i, int j, typename T, typename P, typename U>
+ void xxx_assert(T& rhs, P const& pred, U const& u)
+ {
+ // TODO name lookup?
+ using namespace boost; // tuple<> (cpp03)
+ using namespace boost::assign::v2; // tuple (cpp0x)
+ pred(
+ get<j>(
+ rhs.seq_args().get( boost::mpl::int_<i>() )
+ ),
+ u
+ );
+ }
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ typedef boost::mpl::int_<0> zero_;
+ {
+ typedef as2::put_pipe_aux::rhs<> rhs_;
+ int x = -1;
+ BOOST_AUTO( rhs, ( ( rhs_() % ( as2::_repeat = 3 ) )( x ) ) );
+ int n = as2::ref::at<0>( rhs.pars() ).arg();
+ BOOST_ASSIGN_V2_CHECK( n == 3 );
+ }
+ {
+ /* rvalue */
+ #define A -10
+ #define B 10
+ /* lvalue */
+ int a1 = -1, b1 = 0;
+ typedef const int cint_;
+ cint_ a = 4, b = 5;
+
+ BOOST_AUTO(
+ rhs,
+ ( as2::_put
+ ( a1, b1 )( a1, b )( a1, B )
+ ( a, b1 )( a, b )( a, B )
+ ( A, b1 )( A, b )( A, B )
+ ( a1 )
+ ( a )
+ ( A )
+ ()
+ )
+ );
+
+ namespace chk = as2::checking;
+ typedef chk::equal_ref r_;
+ typedef chk::equal_val v_;
+
+ xxx_assert<0, 0>( rhs, r_(), a1);
+ xxx_assert<0, 1>( rhs, r_(), b1);
+ xxx_assert<1, 0>( rhs, r_(), a1); xxx_assert<1, 1>( rhs, r_(), b);
+ xxx_assert<2, 0>( rhs, r_(), a1); xxx_assert<2, 1>( rhs, v_(), B);
+
+ xxx_assert<3, 0>( rhs, r_(), a ); xxx_assert<3, 1>( rhs, r_(), b1);
+ xxx_assert<4, 0>( rhs, r_(), a ); xxx_assert<4, 1>( rhs, r_(), b);
+ xxx_assert<5, 0>( rhs, r_(), a ); xxx_assert<5, 1>( rhs, v_(), B);
+
+ xxx_assert<6, 0>( rhs, v_(), A); xxx_assert<6, 1>( rhs, r_(), b1);
+ xxx_assert<7, 0>( rhs, v_(), A); xxx_assert<7, 1>( rhs, r_(), b);
+ xxx_assert<8, 0>( rhs, v_(), A); xxx_assert<8, 1>( rhs, v_(), B);
+
+ xxx_assert<9, 0>( rhs, r_(), a1);
+ xxx_assert<10, 0>( rhs, r_(), a);
+ xxx_assert<11, 0>( rhs, v_(), A);
+
+#undef A
+#undef B
+ }
+ {
+ BOOST_AUTO(rhs, as2::_put( "x" ) );
+ typedef boost::mpl::int_<0> int_;
+ typedef std::string str_;
+ using namespace boost;
+ BOOST_ASSIGN_V2_CHECK(
+ str_( get<0>( rhs.seq_args().get( int_() ) ) ) == "x"
+ );
+ }
+ }
+
+
+}// xxx_rhs
+}// xxx_functor
+}// xxx_pipe
+}// xxx_put
+}// test_assign_v2

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/functor/rhs.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/functor/rhs.h 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,27 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef LIBS_ASSIGN_V2_TEST_PUT_PIPE_FUNCTOR_RHS_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_FUNCTOR_RHS_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_functor{
+namespace xxx_rhs{
+
+ void test();
+
+}// xxx_rhs
+}// xxx_functor
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo.cpp 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,57 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#include <list>
+#include <boost/mpl/vector/vector10.hpp>
+#include <boost/assign/v2/detail/functor/identity.hpp>
+#include <boost/assign/v2/detail/checking/check.hpp>
+#include <boost/assign/v2/put/std/push_front.hpp>
+#include <boost/assign/v2/put/container.hpp>
+#include <boost/assign/v2/put/modulo/fun.hpp>
+#include <boost/assign/v2/put/modulo/modifier.hpp>
+#include <boost/assign/v2/put/pipe/functor.hpp>
+#include <boost/assign/v2/put/pipe/modulo/forward.hpp>
+
+#include <libs/assign/v2/test/put/pipe/modulo.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+
+ void test()
+ {
+ using namespace boost::assign::v2;
+ typedef std::list<int> cont_;
+ cont_ cont;
+ typedef modifier_tag::push_front modifier_tag_;
+ typedef functor_aux::identity identity_;
+ typedef put_modulo_aux::fun<identity_> fun_;
+ typedef put_modulo_aux::modifier<modifier_tag_> modifier_;
+ typedef boost::mpl::vector2<fun_, modifier_> pars_;
+ typedef int T;
+ T x = 1, y = 2, z = 3;
+ put_pipe_aux::forward_pars<pars_>(
+ put( cont ),
+ (
+ _put % (
+ _fun = _identity
+ ) % ( _modifier = modifier_tag_() )
+ ).pars()
+ )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( cont.size() == 3 );
+ BOOST_ASSIGN_V2_CHECK( cont.front() == z ); cont.pop_front();
+ BOOST_ASSIGN_V2_CHECK( cont.front() == y ); cont.pop_front();
+ BOOST_ASSIGN_V2_CHECK( cont.front() == x ); cont.pop_front();
+ }
+
+}// xxx_modulo
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo.h 2011-01-27 18:27:25 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,25 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are 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) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef LIBS_ASSIGN_V2_TEST_PUT_PIPE_MODULO_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_MODULO__ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+
+ void test();
+
+}// xxx_modulo
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif


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