Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69557 - in sandbox/assign_v2/libs/assign/v2/test/put/pipe: . modulo
From: erwann.rogard_at_[hidden]
Date: 2011-03-04 15:56:54


Author: e_r
Date: 2011-03-04 15:56:51 EST (Fri, 04 Mar 2011)
New Revision: 69557
URL: http://svn.boost.org/trac/boost/changeset/69557

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

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/container.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/container.cpp 2011-03-04 15:56:51 EST (Fri, 04 Mar 2011)
@@ -0,0 +1,136 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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 <boost/array.hpp>
+#include <deque>
+#include <list>
+#include <map>
+#include <queue>
+#include <set>
+#include <stack>
+#include <vector>
+#include <string>
+#include <boost/assign/v2/detail/config/check.hpp>
+#include <boost/assign/v2/put/pipe/functor.hpp>
+#include <boost/assign/v2/put/pipe/csv.hpp> // Until workaround
+
+#include <libs/assign/v2/test/put/pipe/container.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_container{ // either functor or csv
+
+ void test(){
+ namespace as2 = boost::assign::v2;
+ {
+ //[put_pipe_functor_array
+ typedef int T;
+ T x = 1, y = 2, z = 3;
+ boost::array<T, 3> cont;
+ BOOST_ASSIGN_V2_CHECK(
+ ( cont | as2::_put( x )( y )( z ) )[0] == x
+ );
+ BOOST_ASSIGN_V2_CHECK( cont[2] == z );
+ //]
+ }
+ {
+ //[put_pipe_csv_array
+ typedef int T;
+ T x = 1, y = 2, z = 3;
+ boost::array<T, 3> cont;
+ BOOST_ASSIGN_V2_CHECK(
+ ( cont | as2::_csv_put( x, y, z ) )[0] == x
+ );
+ BOOST_ASSIGN_V2_CHECK( cont[2] == z );
+ //]
+ }
+ {
+ //[put_pipe_functor_map
+ std::map<std::string, int> assoc;
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ assoc | as2::_put( "jan", 31 )( "feb", 28 )( "mar", 31 )( "apr", 30)
+ )["feb"] == 28
+ );
+ //]
+ }
+ {
+ //[put_pipe_functor_set
+ typedef std::string T;
+ std::set<T> assoc;
+ T x = "isomer", y = "ephemeral", z = "prosaic";
+ BOOST_ASSIGN_V2_CHECK(
+ ( assoc | as2::_put( x )( y )( z ) ).count( x ) == 1
+ );
+ BOOST_ASSIGN_V2_CHECK( assoc.count( z ) == 1 );
+ //]
+ }
+ {
+ //[put_pipe_functor_deque
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::deque<T> cont;
+ BOOST_ASSIGN_V2_CHECK((
+ cont | as2::_put( x )( y )( z )
+ ).front() == x );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == z );
+ //]
+ }
+ {
+ //[put_pipe_functor_list
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::list<T> cont;
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ cont | as2::_put( x )( y )( z )
+ ).front() == x );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == z );
+ //]
+ }
+ {
+ //[put_pipe_functor_vector
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::vector<T> cont;
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ cont | as2::_put( x )( y )( z )
+ ).front() == x
+ );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == z );
+ //]
+ }
+ {
+ //[put_pipe_functor_queue
+ typedef int T; T x = 8, y = 7, z = 6;
+ std::queue<T> fifo;
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ fifo | as2::_put( x )( y )( z )
+ ).front() == x
+ );
+ BOOST_ASSIGN_V2_CHECK( fifo.back() == z );
+ //]
+ }
+ {
+ //[put_pipe_functor_stack
+ typedef int T; T x = 8, y = 7, z = 4;
+ std::stack<T> lifo;
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ lifo | as2::_put( x )( y )( z )
+ ).top() == z ); lifo.pop();
+ BOOST_ASSIGN_V2_CHECK( lifo.top() == y );
+ //]
+ }
+ }// test()
+
+}// xxx_container
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/container.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/container.h 2011-03-04 15:56:51 EST (Fri, 04 Mar 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_CONTAINER_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_CONTAINER_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_container{
+
+ void test();
+
+}// xxx_container
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/forward.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/forward.cpp 2011-03-04 15:56:51 EST (Fri, 04 Mar 2011)
@@ -0,0 +1,58 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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/config/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/std.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/forward.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+namespace xxx_forward{
+
+ void test()
+ {
+ using namespace boost::assign::v2;
+ typedef std::list<int> C; C cont;
+ typedef modifier_tag::push_front modifier_tag_;
+ typedef functor_aux::identity identity_;
+ typedef put_aux::modulo_fun<identity_> fun_;
+ typedef put_aux::modulo_std<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
+ ) % ( _std = 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_forward
+}// xxx_modulo
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/forward.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/forward.h 2011-03-04 15:56:51 EST (Fri, 04 Mar 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_MODULO_FORWARD_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_MODULO_FORWARD_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+namespace xxx_forward{
+
+ void test();
+
+}// xxx_forward
+}// xxx_modulo
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/fun.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/fun.cpp 2011-03-04 15:56:51 EST (Fri, 04 Mar 2011)
@@ -0,0 +1,58 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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 <vector>
+#include <boost/lambda/lambda.hpp>
+#include <boost/assign/v2/detail/config/check.hpp>
+#include <boost/assign/v2/put/modulo/fun.hpp>
+#include <boost/assign/v2/put/pipe/functor.hpp>
+#include <boost/assign/v2/put/pipe/csv.hpp>
+#include <libs/assign/v2/test/put/pipe/modulo/fun.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+namespace xxx_fun{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ namespace lambda = boost::lambda;
+ {
+ //[put_pipe_functor_fun
+ typedef int T; T x = 1, y = 2, z = 0; std::vector<T> cont;
+
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ cont | (
+ as2::_put % ( as2::_fun = ( lambda::_1 + 1 ) )
+ )( x )( y )( z )
+ ).front() == ( x + 1 ) );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == ( z + 1 ) );
+ //]
+ }
+ {
+ //[put_pipe_csv_fun
+ typedef int T; T x = 1, y = 2, z = 0; std::vector<T> cont;
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ cont | ( as2::_csv_put % ( as2::_fun = ( lambda::_1 + 1 ) )
+ )( x, y, z ) ).front() == ( x + 1 )
+ );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == ( z + 1 ) );
+ //]
+ }
+ }
+
+}// xxx_fun
+}// xxx_modulo
+}// xxx_pipe
+}// xxx_put
+}// test_assign_v2

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/fun.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/fun.h 2011-03-04 15:56:51 EST (Fri, 04 Mar 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_MODULO_FUN_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_MODULO_FUN_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+namespace xxx_fun{
+
+ void test();
+
+}// xxx_fun
+}// xxx_modulo
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/std.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/std.cpp 2011-03-04 15:56:51 EST (Fri, 04 Mar 2011)
@@ -0,0 +1,54 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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 <deque>
+#include <boost/lambda/lambda.hpp>
+#include <boost/assign/v2/detail/config/check.hpp>
+#include <boost/assign/v2/put/std/push_front.hpp>
+#include <boost/assign/v2/put/pipe/functor.hpp>
+#include <boost/assign/v2/put/pipe/csv.hpp>
+#include <libs/assign/v2/test/put/pipe/modulo/std.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+namespace xxx_std{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ namespace lambda = boost::lambda;
+ {
+ //[put_pipe_functor_push_front
+ typedef int T; T x = 1, y = 2, z = 0; std::deque<int> cont;
+ BOOST_ASSIGN_V2_CHECK(
+ (
+ cont | ( as2::_put % as2::_push_front )( x )( y )( z )
+ ).front() == z
+ );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == x );
+ //]
+ }
+ {
+ //[put_pipe_csv_push_front
+ typedef int T; T x = 1, y = 2, z = 0; std::deque<int> cont;
+ BOOST_ASSIGN_V2_CHECK(
+ ( cont | ( as2::_csv_put % as2::_push_front )( x, y, z )
+ ).front() == z );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == x );
+ //]
+ }
+ }
+
+}// xxx_std
+}// xxx_modulo
+}// xxx_pipe
+}// xxx_put
+}// test_assign_v2

Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/std.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/modulo/std.h 2011-03-04 15:56:51 EST (Fri, 04 Mar 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_MODULO_STD_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_MODULO_STD_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_modulo{
+namespace xxx_std{
+
+ void test();
+
+}// xxx_std
+}// 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