From 1a1b40925b3df5e383cec254adb658dec59b6e86 Mon Sep 17 00:00:00 2001 From: Tobias Schwinger Date: Wed, 21 Mar 2007 18:41:35 +0000 Subject: [PATCH] adds repetitive_view test [SVN r37257] --- test/Jamfile | 1 + test/sequence/repetitive_view.cpp | 53 +++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 test/sequence/repetitive_view.cpp diff --git a/test/Jamfile b/test/Jamfile index 58635536..c916c1b7 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -105,6 +105,7 @@ import testing ; [ run sequence/zip_view.cpp : : : : ] [ run sequence/zip_view2.cpp : : : : ] [ run sequence/zip_view_ignore.cpp : : : : ] + [ run sequence/repetitive_view.cpp : : : : ] [ run sequence/deduce_sequence.cpp : : : : ] [ run functional/fused.cpp : : : : ] [ run functional/fused_function_object.cpp : : : : ] diff --git a/test/sequence/repetitive_view.cpp b/test/sequence/repetitive_view.cpp new file mode 100644 index 00000000..0a2c01d9 --- /dev/null +++ b/test/sequence/repetitive_view.cpp @@ -0,0 +1,53 @@ +/*============================================================================= + Copyright (c) 2007 Tobias Schwinger + + 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 +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +struct check_equal +{ + template + void operator()(LHS const& lhs, RHS const& rhs) const + { + BOOST_TEST(( boost::is_same::value )); + BOOST_TEST(( lhs == rhs )); + } +}; + +int main() +{ + using namespace boost::fusion; + + typedef boost::fusion::vector seq_t; + seq_t seq(1,2l,3.0f,4.0); + + typedef repetitive_view view_t; + view_t view(seq); + + typedef joint_view seq_twice_t; + typedef joint_view seq_repeated_t; + seq_twice_t seq_twice(seq,seq); + seq_repeated_t seq_repeated(seq,seq_twice); + + for_each(zip(view,seq_repeated), make_fused_procedure(check_equal())); + + return boost::report_errors(); +} +