|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r68499 - sandbox/assign_v2/libs/assign/v2/test/put/container
From: erwann.rogard_at_[hidden]
Date: 2011-01-27 18:26:23
Author: e_r
Date: 2011-01-27 18:26:18 EST (Thu, 27 Jan 2011)
New Revision: 68499
URL: http://svn.boost.org/trac/boost/changeset/68499
Log:
upd assign_v2
Added:
sandbox/assign_v2/libs/assign/v2/test/put/container/
sandbox/assign_v2/libs/assign/v2/test/put/container/csv.cpp (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/put/container/csv.h (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/put/container/functor.cpp (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/put/container/functor.h (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/put/container/range.cpp (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/put/container/range.h (contents, props changed)
Added: sandbox/assign_v2/libs/assign/v2/test/put/container/csv.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/container/csv.cpp 2011-01-27 18:26:18 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,36 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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/container.hpp>
+#include <libs/assign/v2/test/put/container/csv.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_container{
+namespace xxx_csv{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ //[csv_list
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::list<T> seq1, seq2;
+ ( as2::put( seq1 ) )( x )( y )( z );
+ ( as2::csv_put( seq2 ) )( x, y, z );
+ BOOST_ASSIGN_V2_CHECK( seq1 == seq2 );
+ //]
+ }
+
+}// xxx_csv
+}// xxx_container
+}// xxx_put
+}// test_assign_v2
+
Added: sandbox/assign_v2/libs/assign/v2/test/put/container/csv.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/container/csv.h 2011-01-27 18:26:18 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_CONTAINER_CSV_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_CONTAINER_CSV_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_container{
+namespace xxx_csv{
+
+ void test();
+
+}// xxx_csv
+}// xxx_container
+}// xxx_put
+}// xxx_test_assign
+
+#endif
Added: sandbox/assign_v2/libs/assign/v2/test/put/container/functor.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/container/functor.cpp 2011-01-27 18:26:18 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,108 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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/checking/check.hpp>
+#include <boost/assign/v2/put/container/functor.hpp>
+
+#include <libs/assign/v2/test/put/container/functor.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_container{
+namespace xxx_functor{
+
+ void test(){
+ namespace as2 = boost::assign::v2;
+ {
+ //[array
+ typedef int T;
+ T x = 1, y = 2, z = 3;
+ boost::array<T, 3> ar;
+ as2::put( ar )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( ar[0] == x );
+ BOOST_ASSIGN_V2_CHECK( ar[2] == z );
+ //]
+ }
+ {
+ //[map
+ std::map<std::string, int> assoc;
+ as2::put( assoc )( "jan", 31 )( "feb", 28 )( "mar", 31 );
+ BOOST_ASSIGN_V2_CHECK( assoc["feb"] == 28 );
+ //]
+ }
+ {
+ //[set
+ typedef std::string T;
+ std::set<T> assoc;
+ T x = "isomer", y = "ephemeral", z = "prosaic";
+ as2::put( assoc )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( assoc.count( x ) == 1 );
+ BOOST_ASSIGN_V2_CHECK( assoc.count( z ) == 1 );
+ //]
+ }
+ {
+ //[deque
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::deque<T> seq;
+ as2::put( seq )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( seq.front() == x );
+ BOOST_ASSIGN_V2_CHECK( seq.back() == z );
+ //]
+ }
+ {
+ //[list
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::list<T> seq;
+ ( as2::put( seq ) )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( seq.front() == x );
+ BOOST_ASSIGN_V2_CHECK( seq.back() == z );
+ //]
+ }
+ {
+ //[vector
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::vector<T> seq;
+ as2::put( seq )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( seq.front() == x );
+ BOOST_ASSIGN_V2_CHECK( seq.back() == z );
+ //]
+ }
+ {
+ //[queue
+ typedef int T; T x = 8, y = 7, z = 6;
+ std::queue<T> fifo;
+ as2::put( fifo )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( fifo.front() == x );
+ BOOST_ASSIGN_V2_CHECK( fifo.back() == z );
+ //]
+ }
+ {
+ //[stack
+ typedef int T; T x = 8, y = 7, z = 4;
+ std::stack<T> lifo;
+ as2::put( lifo )( x )( y )( z );
+ BOOST_ASSIGN_V2_CHECK( lifo.top() == z ); lifo.pop();
+ BOOST_ASSIGN_V2_CHECK( lifo.top() == y );
+ //]
+ }
+ }// test()
+
+}// xxx_functor
+}// xxx_container
+}// xxx_put
+}// xxx_test_assign
Added: sandbox/assign_v2/libs/assign/v2/test/put/container/functor.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/container/functor.h 2011-01-27 18:26:18 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,22 @@
+//////////////////////////////////////////////////////////////////////////////
+// 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) //
+//////////////////////////////////////////////////////////////////////////////
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_container{
+namespace xxx_functor{
+
+ void test();
+
+}// xxx_functor
+}// xxx_container
+}// xxx_put
+}// xxx_test_assign
+
Added: sandbox/assign_v2/libs/assign/v2/test/put/container/range.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/container/range.cpp 2011-01-27 18:26:18 EST (Thu, 27 Jan 2011)
@@ -0,0 +1,60 @@
+////////////////////////////////////////////////////////////////////////////
+// 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 <stack>
+#include <vector>
+#include <boost/array.hpp>
+#include <boost/assign/v2/detail/checking/check.hpp>
+#include <boost/assign/v2/put/container/range.hpp>
+#include <libs/assign/v2/test/put/container/range.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_container{
+namespace xxx_range{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+
+ //[range_var
+ typedef int T; T x = 1, y = 2, z = 0;
+ std::vector<T> r( 3 ); r[0] = x; r[1] = y; r[2] = z;
+ //]
+
+ // Forwards to put()
+ {
+ //[range_array
+ boost::array<T, 3> cont; as2::put_range( cont, r );
+ BOOST_ASSIGN_V2_CHECK( cont.front() == x );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == z );
+ //]
+ }
+ {
+ //[range_stack
+ typedef std::stack<T> cont_;
+ BOOST_ASSIGN_V2_CHECK( as2::put_range<cont_>( r ).top() == x );
+ //]
+ }
+
+ // Calls C(b, e)
+ {
+ //[range_deque
+ std::deque<T> cont; as2::put_range( cont, r );
+ BOOST_ASSIGN_V2_CHECK( cont.front() == x );
+ BOOST_ASSIGN_V2_CHECK( cont.back() == z );
+ //]
+ }
+ }
+
+}// xxx_range
+}// xxx_container
+}// xxx_put
+}// test_assign_v2
Added: sandbox/assign_v2/libs/assign/v2/test/put/container/range.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/container/range.h 2011-01-27 18:26:18 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_CONTAINER_RANGE_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_CONTAINER_RANGE_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_container{
+namespace xxx_range{
+
+ void test();
+
+}// xxx_range
+}// xxx_container
+}// 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