$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r69767 - sandbox/assign_v2/libs/assign/v2/test/put/pipe
From: erwann.rogard_at_[hidden]
Date: 2011-03-09 08:06:09
Author: e_r
Date: 2011-03-09 08:06:08 EST (Wed, 09 Mar 2011)
New Revision: 69767
URL: http://svn.boost.org/trac/boost/changeset/69767
Log:
upd assign_v2
Added:
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.cpp   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.h   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.cpp   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.h   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/operator.cpp   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/pipe/operator.h   (contents, props changed)
Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.cpp	2011-03-09 08:06:08 EST (Wed, 09 Mar 2011)
@@ -0,0 +1,99 @@
+//////////////////////////////////////////////////////////////////////////////
+//  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/check/equal_val.hpp>
+#include <boost/assign/v2/detail/check/equal_ref.hpp>
+#include <boost/assign/v2/put/modifier/repeat.hpp>
+#include <boost/assign/v2/put/pipe/functor.hpp> 
+#include <boost/assign/v2/utility/csv.hpp>
+#include <libs/assign/v2/test/put/pipe/args_list.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_args_list{
+
+    void test()
+    {
+        namespace as2 = boost::assign::v2;
+        typedef boost::mpl::int_<0> zero_;
+        {
+            typedef as2::put_pipe_aux::args_list<> args_list_;
+            int x = -1;
+            BOOST_AUTO( args_list, ( ( args_list_() %  ( as2::_repeat = 3 ) )( x ) ) );
+            int n = as2::ref::at<0>( args_list.par_list_cont() ).arg();
+            BOOST_ASSIGN_V2_CHECK( n == 3 );
+        }
+        namespace chk = as2::check_aux;
+        namespace aux_ = as2::put_pipe_aux;
+        typedef chk::equal_ref r_;
+        typedef chk::equal_val v_;
+        {
+/* rvalue */
+#define A -10
+#define B 10
+            /* lvalue */
+            int a1 = -1, b1 = 0;
+            typedef const int cint_;
+            cint_ a = 4, b = 5;
+
+            BOOST_AUTO(
+                args_list,
+                ( as2::_put
+                    ( a1, b1 )( a1, b )( a1, B )
+                    ( a, b1 )( a, b )( a, B )
+                    ( A, b1 )( A, b )( A, B )
+                    ( a1 )
+                    ( a )
+                    ( A )
+                    ()
+                )
+            );
+
+            aux_::check_args_list<0, 0>( args_list, r_(), a1);
+            aux_::check_args_list<0, 1>( args_list, r_(), b1);
+            aux_::check_args_list<1, 0>( args_list, r_(), a1); aux_::check_args_list<1, 1>( args_list, r_(), b);
+            aux_::check_args_list<2, 0>( args_list, r_(), a1); aux_::check_args_list<2, 1>( args_list, v_(), B);
+
+            aux_::check_args_list<3, 0>( args_list, r_(), a ); aux_::check_args_list<3, 1>( args_list, r_(), b1);
+            aux_::check_args_list<4, 0>( args_list, r_(), a ); aux_::check_args_list<4, 1>( args_list, r_(), b);
+            aux_::check_args_list<5, 0>( args_list, r_(), a ); aux_::check_args_list<5, 1>( args_list, v_(), B);
+
+            aux_::check_args_list<6, 0>( args_list, v_(), A); aux_::check_args_list<6, 1>( args_list, r_(), b1);
+            aux_::check_args_list<7, 0>( args_list, v_(), A); aux_::check_args_list<7, 1>( args_list, r_(), b);
+            aux_::check_args_list<8, 0>( args_list, v_(), A); aux_::check_args_list<8, 1>( args_list, v_(), B);
+
+            aux_::check_args_list<9, 0>( args_list, r_(), a1);
+            aux_::check_args_list<10, 0>( args_list, r_(), a);
+            aux_::check_args_list<11, 0>( args_list, v_(), A);
+#undef A
+#undef B
+        }
+        {
+            // str_literal
+            BOOST_AUTO(args_list, as2::_put( "x" ) );
+            typedef boost::mpl::int_<0> int_;
+            typedef std::string str_;
+            #if BOOST_ASSIGN_V2_ENABLE_CPP0X
+            using namespace boost::assign::v2::ref;
+            #else
+            using namespace boost;
+            #endif
+            aux_::check_args_list<0, 0>( args_list, v_(), str_( "x" ) );
+        }
+    }
+
+
+}// xxx_args_list
+}// xxx_pipe
+}// xxx_put
+}// test_assign_v2
Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/args_list.h	2011-03-09 08:06:08 EST (Wed, 09 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_ARGS_LIST_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_ARGS_LIST_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_args_list{
+
+    void test();
+
+}// xxx_args_list
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif
Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.cpp	2011-03-09 08:06:08 EST (Wed, 09 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 <vector>
+#include <boost/spirit/home/phoenix.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/fun.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_fun{
+
+    void test()
+    {
+        namespace as2 = boost::assign::v2;
+        namespace lambda = boost::phoenix;
+        {
+            //[pipe_modulo_fun
+            typedef int int_; std::vector<int_> incr_fact;
+            int_ front = ( 
+            	incr_fact | ( as2::_put % ( as2::_fun = lambda::arg_names::arg1 + 1 ) )/*<<1!, 2!, 3!, 4!, 5!>>*/( 1 )( 2 )( 6 )( 24 )( 120 ) 
+            ).front(); 
+		
+            BOOST_ASSIGN_V2_CHECK( front == 2  );
+            BOOST_ASSIGN_V2_CHECK( incr_fact.back() == 121 );
+            //]
+        }
+        {
+            //[csv_pipe_modulo_fun
+            typedef int int_; std::vector<int_> incr_fact;
+            int_ front = ( 
+            	incr_fact | ( as2::_csv_put % ( as2::_fun = lambda::arg_names::arg1 + 1 ) )/*<<1!, 2!, 3!, 4!, 5!>>*/( 1, 2, 6, 24, 120 ) 
+            ).front(); 
+		
+            BOOST_ASSIGN_V2_CHECK( front == 2 );
+            BOOST_ASSIGN_V2_CHECK( incr_fact.back() == 121 );
+            //]
+		}
+    }
+
+}// xxx_fun
+}// xxx_pipe
+}// xxx_put
+}// test_assign_v2
Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/fun.h	2011-03-09 08:06:08 EST (Wed, 09 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_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_fun{
+
+    void test();
+
+}// xxx_fun
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif
Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/operator.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/operator.cpp	2011-03-09 08:06:08 EST (Wed, 09 Mar 2011)
@@ -0,0 +1,118 @@
+//////////////////////////////////////////////////////////////////////////////
+//  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 <map>
+#include <deque>
+#include <vector>
+#include <list>
+#include <string>
+#include <boost/array.hpp>
+#include <boost/tuple/tuple.hpp>
+#include <boost/numeric/conversion/bounds.hpp>
+#include <boost/assign/v2/detail/config/check.hpp>
+#include <boost/assign/v2/put/pipe/functor.hpp>
+#include <boost/assign/v2/put/pipe/csv.hpp> 
+
+#include <libs/assign/v2/test/put/pipe/operator.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_operator{ 
+
+    void test(){
+        namespace as2 = boost::assign::v2;
+    	{
+        	//pipe_str_literal
+	        typedef const char* T;
+			std::deque<T> cont; typedef std::string str_;
+        	BOOST_ASSIGN_V2_CHECK( str_( 
+            	( cont | as2::_put( "x" )( "y" )( "z" ) )[0] 
+        	) == "x" );
+        	BOOST_ASSIGN_V2_CHECK( str_( cont[1] ) == "y" );
+        	BOOST_ASSIGN_V2_CHECK( str_( cont[2] ) == "z" );
+    	}
+		{
+            //[pipe_array
+            const int sz = 3;
+    		typedef boost::array<int, sz>  r_;
+    		boost::array<r_, sz>  matrix3x3;
+            
+            {
+            	r_ r0, r1, r2;
+                int front = ( /*Calls [^r0[i] = j] for [^( i, j ) = ( 0, 1 ), ( 1, 2 ), ( 2, 3 ) ] and returns r0*/ r0 | as2::_put( 1 )( 2 )( 3 ) ).front();
+                int back = r0.back();
+                r2 | as2::_put( 7 )( 8 )( 9 );
+            	r_ r = ( 
+                	matrix3x3 | as2::_put
+                		( r0 )  
+                    	( /*<<`r1` modified on the fly>>*/r1 | as2::_put( 4 )( 5 )( 6 ) ) 
+                    	( r2 )
+                )[1];
+
+                BOOST_ASSIGN_V2_CHECK( front == 1    );
+                BOOST_ASSIGN_V2_CHECK( back  == 3    );
+                BOOST_ASSIGN_V2_CHECK( r   == r1 );
+			}
+            for(int i = 0; i < 9; i++)
+            {
+            	BOOST_ASSIGN_V2_CHECK( matrix3x3[ i / 3 ][ i % 3 ] == i + 1 );
+            }
+			//]
+        }
+		{
+        	//[pipe_seq_var_args
+            typedef double elem_; typedef std::list<elem_> r_; typedef std::vector<r_> ragged_array_;
+			r_ a, b; elem_ front, back;
+            front = ( a | as2::_put( 0.71 )( 0.63 )( 0.85 ) ).front();
+            back = a.back();
+            
+			ragged_array_ ragged_array; 
+            r_ r = (
+            	ragged_array | as2::_put
+            		( a ) 
+                	( /*<<`b` modified on the fly>>*/ b | as2::_put( 0.61 )( 0.69 )( 0.92 )( 0.55 ) )
+					( 1, -99.99 )
+                	( )
+            )[2];
+
+			elem_ eps = boost::numeric::bounds<elem_>::smallest();
+            BOOST_ASSIGN_V2_CHECK( abs( front - 0.71     ) < eps );
+            BOOST_ASSIGN_V2_CHECK( abs( back - 0.85      ) < eps );
+            BOOST_ASSIGN_V2_CHECK( abs( r.front() + 99.0 ) < eps ); 
+            BOOST_ASSIGN_V2_CHECK( abs( r.back() + 99.0  ) < eps ); 
+            //]
+            BOOST_ASSIGN_V2_CHECK( ragged_array[0].size() == a.size() );
+            BOOST_ASSIGN_V2_CHECK( ragged_array[1].size() == b.size() );
+            BOOST_ASSIGN_V2_CHECK( ragged_array[2].size() == 1        );
+            BOOST_ASSIGN_V2_CHECK( ragged_array[3].size() == 0        );
+		}
+		{
+            using namespace boost;
+            //[pipe_seq_ref_tuple
+            typedef const char state_ [3]; state_ ct = "CT", nj = "NJ", ny = "NY";
+            typedef int code_; typedef boost::tuple<state_/*<<Notice the reference>>*/&,  code_> area_code_; 
+            std::deque< area_code_ > tri_state;
+            area_code_ front = (
+            	tri_state | as2::_put( nj, 201 )( ct, 203 )( ny, 212 )( ny, 315 )( ny, 347 )( nj, 551 )
+            ).front();
+
+            BOOST_ASSIGN_V2_CHECK( get<0>( front ) == nj );
+            BOOST_ASSIGN_V2_CHECK( get<1>( front ) == 201 );
+            BOOST_ASSIGN_V2_CHECK( get<0>( tri_state.back() ) == nj );
+            BOOST_ASSIGN_V2_CHECK( get<1>( tri_state.back() ) == 551 );
+            //]
+        }
+
+    }// test()
+
+}// xxx_operator
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
\ No newline at end of file
Added: sandbox/assign_v2/libs/assign/v2/test/put/pipe/operator.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/pipe/operator.h	2011-03-09 08:06:08 EST (Wed, 09 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_OPERATOR_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_PIPE_OPERATOR_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_pipe{
+namespace xxx_operator{
+
+    void test();
+
+}// xxx_operator
+}// xxx_pipe
+}// xxx_put
+}// xxx_test_assign
+
+#endif