diff --git a/test/Jamfile b/test/Jamfile index 496697f9..26c62df0 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -61,6 +61,17 @@ import testing ; [ run sequence/list_mutate.cpp : : : : ] [ run sequence/list_tie.cpp : : : : ] [ run sequence/list_value_at.cpp : : : : ] + [ run sequence/deque_comparison.cpp : : : : ] + [ run sequence/deque_construction.cpp : : : : ] + [ run sequence/deque_copy.cpp : : : : ] + [ run sequence/deque_iterator.cpp : : : : ] + [ run sequence/deque_make.cpp : : : : ] + [ run sequence/deque_misc.cpp : : : : ] + [ run sequence/deque_mutate.cpp : : : : ] + [ run sequence/deque_tie.cpp : : : : ] + [ run sequence/deque_value_at.cpp : : : : ] + [ run sequence/front_extended_deque.cpp : : : : ] + [ run sequence/back_extended_deque.cpp : : : : ] [ run sequence/make_list.cpp : : : : ] [ run sequence/make_vector.cpp : : : : ] [ run sequence/map.cpp : : : : ] diff --git a/test/sequence/back_extended_deque.cpp b/test/sequence/back_extended_deque.cpp new file mode 100644 index 00000000..2bd5b47c --- /dev/null +++ b/test/sequence/back_extended_deque.cpp @@ -0,0 +1,75 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#include +#include + +#include +#include + +int main() +{ + using namespace boost::fusion; + { + typedef deque initial_deque_type; + initial_deque_type initial_deque(1, 'a'); + typedef back_extended_deque extended_type; + extended_type extended(initial_deque, 101L); + + BOOST_TEST(size(extended) == 3); + BOOST_TEST(extended == make_vector(1, 'a', 101L)); + BOOST_TEST(*begin(extended) == 1); + BOOST_TEST(*next(begin(extended)) == 'a'); + BOOST_TEST(*prior(end(extended)) == 101L); + BOOST_TEST(distance(begin(extended), end(extended)) == 3); + BOOST_TEST(*advance_c<2>(begin(extended)) == 101L); + } + { + namespace mpl = boost::mpl; + typedef deque initial_deque_type; + typedef back_extended_deque extended_type; + + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, char>)); + BOOST_MPL_ASSERT((boost::is_same::type, long>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type, int>)); + BOOST_MPL_ASSERT((mpl::equal_to::type, mpl::int_<3> >)); + } + { + char ch('a'); + long l(101L); + int i(1); + typedef deque initial_deque_type; + initial_deque_type initial_deque(i, ch); + typedef back_extended_deque extended_type; + extended_type extended(initial_deque, l); + BOOST_TEST(extended == make_vector(1, 'a', 101L)); + + char ch2('b'); + long l2(202L); + int i2(2); + extended_type extended2(initial_deque_type(i2, ch2), l2); + + extended = extended2; + + BOOST_TEST(extended == make_vector(2, 'b', 202L)); + + BOOST_TEST(i == i2); + BOOST_TEST(ch == ch2); + BOOST_TEST(l == l2); + } + return boost::report_errors(); +} diff --git a/test/sequence/deque_comparison.cpp b/test/sequence/deque_comparison.cpp new file mode 100644 index 00000000..156e82d8 --- /dev/null +++ b/test/sequence/deque_comparison.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#define FUSION_SEQUENCE deque +#include "comparison.hpp" + +int +main() +{ + equality_test(); + ordering_test(); + return boost::report_errors(); +} diff --git a/test/sequence/deque_construction.cpp b/test/sequence/deque_construction.cpp new file mode 100644 index 00000000..08e8d2f2 --- /dev/null +++ b/test/sequence/deque_construction.cpp @@ -0,0 +1,20 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#define FUSION_SEQUENCE deque +#include "construction.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} diff --git a/test/sequence/deque_copy.cpp b/test/sequence/deque_copy.cpp new file mode 100644 index 00000000..03401efd --- /dev/null +++ b/test/sequence/deque_copy.cpp @@ -0,0 +1,23 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#define FUSION_SEQUENCE deque +#include "copy.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} + diff --git a/test/sequence/deque_iterator.cpp b/test/sequence/deque_iterator.cpp new file mode 100644 index 00000000..be9137a0 --- /dev/null +++ b/test/sequence/deque_iterator.cpp @@ -0,0 +1,20 @@ +/*============================================================================= + 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 + +#define FUSION_SEQUENCE deque +#define FUSION_TRAVERSAL_TAG bidirectional_traversal_tag +#include "./iterator.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} diff --git a/test/sequence/deque_make.cpp b/test/sequence/deque_make.cpp new file mode 100644 index 00000000..624446a3 --- /dev/null +++ b/test/sequence/deque_make.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#define FUSION_SEQUENCE deque +#include "make.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} diff --git a/test/sequence/deque_misc.cpp b/test/sequence/deque_misc.cpp new file mode 100644 index 00000000..cd18270b --- /dev/null +++ b/test/sequence/deque_misc.cpp @@ -0,0 +1,22 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#define FUSION_SEQUENCE deque +#include "misc.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} + diff --git a/test/sequence/deque_mutate.cpp b/test/sequence/deque_mutate.cpp new file mode 100644 index 00000000..516a4b4d --- /dev/null +++ b/test/sequence/deque_mutate.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + Copyright (c) 2001-2006 Joel de Guzman + Copyright (c) 2006 + + 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 + +#define FUSION_SEQUENCE deque +#include "mutate.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} + diff --git a/test/sequence/deque_tie.cpp b/test/sequence/deque_tie.cpp new file mode 100644 index 00000000..42c2404f --- /dev/null +++ b/test/sequence/deque_tie.cpp @@ -0,0 +1,24 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#define FUSION_SEQUENCE deque +#include "tie.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} + diff --git a/test/sequence/deque_value_at.cpp b/test/sequence/deque_value_at.cpp new file mode 100644 index 00000000..a444118b --- /dev/null +++ b/test/sequence/deque_value_at.cpp @@ -0,0 +1,21 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#define FUSION_SEQUENCE deque +#include "value_at.hpp" + +int +main() +{ + test(); + return boost::report_errors(); +} + diff --git a/test/sequence/front_extended_deque.cpp b/test/sequence/front_extended_deque.cpp new file mode 100644 index 00000000..51618d49 --- /dev/null +++ b/test/sequence/front_extended_deque.cpp @@ -0,0 +1,75 @@ +/*============================================================================= + Copyright (c) 1999-2003 Jaakko Järvi + 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 + +#include +#include + +#include +#include + +int main() +{ + using namespace boost::fusion; + { + typedef deque initial_deque_type; + initial_deque_type initial_deque('a', 101L); + typedef front_extended_deque extended_type; + extended_type extended(initial_deque, 1); + + BOOST_TEST(size(extended) == 3); + BOOST_TEST(extended == make_vector(1, 'a', 101L)); + BOOST_TEST(*begin(extended) == 1); + BOOST_TEST(*next(begin(extended)) == 'a'); + BOOST_TEST(*prior(end(extended)) == 101L); + BOOST_TEST(distance(begin(extended), end(extended)) == 3); + BOOST_TEST(*advance_c<2>(begin(extended)) == 101L); + } + { + namespace mpl = boost::mpl; + typedef deque initial_deque_type; + typedef front_extended_deque extended_type; + + BOOST_MPL_ASSERT((boost::is_same::type, int>)); + BOOST_MPL_ASSERT((boost::is_same::type, char>)); + BOOST_MPL_ASSERT((boost::is_same::type, long>)); + BOOST_MPL_ASSERT((boost::is_same::type>::type, int>)); + BOOST_MPL_ASSERT((mpl::equal_to::type, mpl::int_<3> >)); + } + { + char ch('a'); + long l(101L); + int i(1); + typedef deque initial_deque_type; + initial_deque_type initial_deque(ch, l); + typedef front_extended_deque extended_type; + extended_type extended(initial_deque, i); + BOOST_TEST(extended == make_vector(1, 'a', 101L)); + + char ch2('b'); + long l2(202L); + int i2(2); + extended_type extended2(initial_deque_type(ch2, l2), i2); + + extended = extended2; + + BOOST_TEST(extended == make_vector(2, 'b', 202L)); + + BOOST_TEST(i == i2); + BOOST_TEST(ch == ch2); + BOOST_TEST(l == l2); + } + return boost::report_errors(); +}