Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72365 - sandbox/assign_v2/libs/assign/v2/test/deque
From: erwann.rogard_at_[hidden]
Date: 2011-06-02 20:49:14


Author: e_r
Date: 2011-06-02 20:49:13 EDT (Thu, 02 Jun 2011)
New Revision: 72365
URL: http://svn.boost.org/trac/boost/changeset/72365

Log:
upd assign_v2
Added:
   sandbox/assign_v2/libs/assign/v2/test/deque/
   sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque.cpp (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque.h (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/deque/deque.cpp (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/deque/deque.h (contents, props changed)

Added: sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque.cpp 2011-06-02 20:49:13 EDT (Thu, 02 Jun 2011)
@@ -0,0 +1,119 @@
+////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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 <string>
+#include <utility>
+#include <boost/array.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/assign/v2/include/csv_deque.hpp>
+#include <boost/assign/v2/include/deque.hpp>
+#include <boost/assign/v2/support/config/check.hpp>
+#include <boost/range/algorithm/equal.hpp>
+#include <libs/assign/v2/test/deque/csv_deque.h>
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_csv_deque{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ {
+ //[test_csv_deque1
+ typedef as2::result_of::csv_deque<const char[2]>::type C1;
+ typedef as2::result_of::deque<char*>::type result1_;
+ typedef as2::result_of::csv_deque<std::string>::type C2;
+ typedef as2::result_of::deque<std::string>::type result2_;
+
+ BOOST_MPL_ASSERT(( boost::is_same<C1, result1_> ));
+ BOOST_MPL_ASSERT(( boost::is_same<C2, result2_> ));
+
+ C1 deque1 = as2::csv_deque( "x", "y", "z" );
+ C2 deque2 = as2::csv_deque<std::string>( "x", "y", "z" );
+
+ std::deque<std::string> benchmark;
+ benchmark.push_back( "x" );
+ benchmark.push_back( "y" );
+ benchmark.push_back( "z" );
+
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, deque1 ) );
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, deque2 ) );
+ //]
+ }
+ {
+ //[test_csv_deque2
+ typedef std::string month_; typedef int days_;
+ typedef std::pair<month_, days_> t_;
+
+ BOOST_ASSIGN_V2_CHECK(
+ boost::range::equal(
+ as2::csv_deque<t_, 2>( "jan", 31, "feb", 28, "mar", 31 ),
+ as2::csv_deque( t_("jan", 31), t_("feb", 28), t_("mar", 31 ) )
+ )
+ );
+ //]
+ }
+ {
+ //[test_csv_deque3
+ typedef std::string T;
+ typedef as2::result_of::csv_deque<T>::type C;
+
+ BOOST_MPL_ASSERT((
+ boost::is_same<C, as2::result_of::deque<std::string>::type>
+ ));
+
+ C deque = as2::csv_deque<T>( "x", "y", "z" );
+
+ std::deque<std::string> benchmark;
+ benchmark.push_back( "x" );
+ benchmark.push_back( "y" );
+ benchmark.push_back( "z" );
+
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, deque ) );
+ //]
+ }
+ {
+ //[test_csv_deque4
+ typedef as2::result_of::csv_deque<int>::type C;
+
+ BOOST_MPL_ASSERT(( boost::is_same<C, as2::result_of::deque<int>::type> ));
+
+ C series1 = as2::csv_deque( 0, 1, 1, 2, 3, 5, 8 );
+
+ std::deque<int> benchmark; benchmark.push_back( 0 );
+ benchmark.push_back( 1 ); benchmark.push_back( 1 );
+ benchmark.push_back( 2 ); benchmark.push_back( 3 );
+ benchmark.push_back( 5 ); benchmark.push_back( 8 );
+
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, series1 ) );
+
+ C series2 = as2::csv_deque( 0, 1, 1 )( 2 )( 3 )( 5 )( 8 );
+
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, series2 ) );
+ //]
+ }
+ {
+ //[test_csv_deque_converter
+ typedef boost::array<int, 5> C;
+ C const& ar = /*<<Notice unqualified>>*/converter(
+ as2::csv_deque( 1, 2, 3, 4, 5 )
+ );
+
+ BOOST_ASSIGN_V2_CHECK(
+ boost::range::equal( ar, as2::csv_deque( 1, 2, 3, 4, 5 ) )
+ );
+ //]
+ }
+ }
+
+}// xxx_csv_deque
+}// xxx_deque
+}// test_assign_v2

Added: sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque.h 2011-06-02 20:49:13 EDT (Thu, 02 Jun 2011)
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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_DEQUE_CSV_DEQUE_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_DEQUE_CSV_DEQUE_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_csv_deque{
+
+ void test();
+
+}// xxx_csv_deque
+}// xxx_deque
+}// test_assign_v2
+
+#endif // LIBS_ASSIGN_V2_TEST_DEQUE_CSV_DEQUE_ER_2010_H

Added: sandbox/assign_v2/libs/assign/v2/test/deque/deque.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/deque.cpp 2011-06-02 20:49:13 EDT (Thu, 02 Jun 2011)
@@ -0,0 +1,71 @@
+////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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 <string>
+#include <utility>
+#include <boost/array.hpp>
+#include <boost/assign/v2/include/deque.hpp>
+#include <boost/assign/v2/support/config/check.hpp>
+#include <boost/range/algorithm/equal.hpp>
+#include <libs/assign/v2/test/deque/deque.h>
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_deque{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ {
+ //[test_deque1
+ typedef as2::result_of::deque<char*>::type C;
+
+ C deque = as2::deque<char*>( "x" )( "y" )( "z" );
+
+ std::deque<std::string> benchmark;
+ benchmark.push_back( "x" );
+ benchmark.push_back( "y" );
+ benchmark.push_back( "z" );
+
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, deque ) );
+ //]
+ }
+ {
+ //[test_deque2
+ typedef std::string word_;
+ const char x[] = "foo";
+ const char y[4] = { 'b', 'a', 'r', '\0' };
+ word_ z = "***baz";
+
+ std::deque<word_> benchmark;
+ benchmark.push_back( word_( x, 3 ) );
+ benchmark.push_back( word_( y ) );
+ benchmark.push_back( word_( z, 3, 3 ) );
+ benchmark.push_back( word_( "qux" ) );
+
+ typedef as2::result_of::deque<word_>::type C;
+ C cont1 = as2::deque<word_>( as2::_nil );
+
+ BOOST_ASSIGN_V2_CHECK( cont1.empty() );
+
+ cont1( x, 3 )( y )( z, 3, 3 )( "qux" );
+
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, cont1 ) );
+
+ C cont2 = as2::deque<word_>( x, 3 )( y )( z, 3, 3 )( "qux" );
+
+ BOOST_ASSIGN_V2_CHECK( boost::range::equal( benchmark, cont2 ) );
+ //]
+ }
+ }
+
+}// xxx_deque
+}// xxx_deque
+}// test_assign_v2

Added: sandbox/assign_v2/libs/assign/v2/test/deque/deque.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/deque.h 2011-06-02 20:49:13 EDT (Thu, 02 Jun 2011)
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2011 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_DEQUE_DEQUE_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_DEQUE_DEQUE_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_deque{
+
+ void test();
+
+}// xxx_deque
+}// xxx_deque
+}// test_assign_v2
+
+#endif // LIBS_ASSIGN_V2_TEST_DEQUE_DEQUE_ER_2010_H


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