From 7cd89c8d9c5fe8a39a3aa78a476f071ad6a8cf6b Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Sat, 7 Oct 2006 15:40:49 +0000 Subject: [PATCH] additional zip tests for variable length input sequences [SVN r35516] --- test/Jamfile.v2 | 1 + test/algorithm/zip2.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 test/algorithm/zip2.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 31bedbc3..03acc124 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -40,6 +40,7 @@ import testing ; [ run algorithm/transform.cpp : : : : ] [ run algorithm/join.cpp : : : : ] [ run algorithm/zip.cpp : : : : ] + [ run algorithm/zip2.cpp : : : : ] [ run sequence/as_list.cpp : : : : ] [ run sequence/as_map.cpp : : : : ] diff --git a/test/algorithm/zip2.cpp b/test/algorithm/zip2.cpp new file mode 100644 index 00000000..f7efbb7c --- /dev/null +++ b/test/algorithm/zip2.cpp @@ -0,0 +1,31 @@ +/*============================================================================= + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2006 Dan Marsden + + Use, modification and distribution is 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 + +int main() +{ + using namespace boost::fusion; + { + const vector2 shorter(1,2); + const vector3 longer('a', 'b', 'c'); + const vector2, vector2 > result(vector2(1,'a'), vector2(2,'b')); + BOOST_TEST(zip(shorter, longer) == result); + } + { + const vector3 longer(1,2,3); + const vector2 shorter('a', 'b'); + const vector2, vector2 > result(vector2(1,'a'), vector2(2,'b')); + BOOST_TEST(zip(longer, shorter) == result); + } + return boost::report_errors(); +}