|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72452 - sandbox/assign_v2/libs/assign/v2/test/deque
From: erwann.rogard_at_[hidden]
Date: 2011-06-06 21:29:25
Author: e_r
Date: 2011-06-06 21:29:24 EDT (Mon, 06 Jun 2011)
New Revision: 72452
URL: http://svn.boost.org/trac/boost/changeset/72452
Log:
upd assign_v2
Added:
sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_basic.cpp (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_basic.h (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_ext.cpp (contents, props changed)
sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_ext.h (contents, props changed)
Added: sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_basic.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_basic.cpp 2011-06-06 21:29:24 EDT (Mon, 06 Jun 2011)
@@ -0,0 +1,108 @@
+////////////////////////////////////////////////////////////////////////////
+// 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_basic.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_basic.h>
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_csv_deque_basic{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ {
+ //[test_csv_deque_unary1
+ 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_deque_unary2
+ 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_deque_unary3
+ 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_basic
+}// xxx_deque
+}// test_assign_v2
Added: sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_basic.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_basic.h 2011-06-06 21:29:24 EDT (Mon, 06 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_BASIC_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_DEQUE_CSV_DEQUE_BASIC_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_csv_deque_basic{
+
+ void test();
+
+}// xxx_csv_deque_basic
+}// xxx_deque
+}// test_assign_v2
+
+#endif // LIBS_ASSIGN_V2_TEST_DEQUE_CSV_DEQUE_BASIC_ER_2010_H
Added: sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_ext.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_ext.cpp 2011-06-06 21:29:24 EDT (Mon, 06 Jun 2011)
@@ -0,0 +1,75 @@
+////////////////////////////////////////////////////////////////////////////
+// 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 <string>
+#include <boost/assign/v2/include/csv_deque_ext.hpp>
+#include <boost/assign/v2/support/config/check.hpp>
+
+#include <boost/assign/v2/support/config/enable_cpp0x.hpp>
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+#include <tuple>
+#else
+#include <boost/tuple/tuple.hpp>
+#endif
+
+#include <libs/assign/v2/test/deque/csv_deque_ext.h>
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_csv_deque_ext{
+
+ void test()
+ {
+ namespace as2 = boost::assign::v2;
+ {
+ //[test_csv_deque_ext1
+ typedef const char state_ [3]; typedef int code_;
+ state_ ct = "CT", nj = "NJ", ny = "NY";
+
+//<-
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+//->
+ typedef std::tuple<state_/*<<Notice the reference>>*/&, code_> data_;
+//<-
+#else
+ typedef boost::tuple<state_&, code_> data_;
+#endif
+//->
+ as2::result_of::deque<
+ data_
+ >::type region = as2::csv_deque<data_, 2>(
+ ny, 212, ny, 718, ny, 516, ny, 914,
+ nj, 210, nj, 908, nj, 609,
+ ct, 203
+ );
+
+//<-
+#if BOOST_ASSIGN_V2_ENABLE_CPP0X
+//->
+ BOOST_ASSIGN_V2_CHECK( std::get<0>( region.front() ) == ny );
+ BOOST_ASSIGN_V2_CHECK( std::get<1>( region.back() ) == 203 );
+ BOOST_ASSIGN_V2_CHECK( std::get<1>( region.front() ) == 212 );
+ BOOST_ASSIGN_V2_CHECK( std::get<0>( region.back() ) == ct );
+//<-
+#endif
+//->
+ //]
+#if! BOOST_ASSIGN_V2_ENABLE_CPP0X
+ BOOST_ASSIGN_V2_CHECK( boost::get<0>( region.front() ) == ny );
+ BOOST_ASSIGN_V2_CHECK( boost::get<1>( region.back() ) == 203 );
+ BOOST_ASSIGN_V2_CHECK( boost::get<1>( region.front() ) == 212 );
+ BOOST_ASSIGN_V2_CHECK( boost::get<0>( region.back() ) == ct );
+#endif
+ }
+
+ }
+
+}// xxx_csv_deque_ext
+}// xxx_deque
+}// test_assign_v2
Added: sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_ext.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/deque/csv_deque_ext.h 2011-06-06 21:29:24 EDT (Mon, 06 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_EXT_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_DEQUE_CSV_DEQUE_EXT_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_deque{
+namespace xxx_csv_deque_ext{
+
+ void test();
+
+}// xxx_csv_deque_ext
+}// xxx_deque
+}// test_assign_v2
+
+#endif // LIBS_ASSIGN_V2_TEST_DEQUE_CSV_DEQUE_EXT_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