From 6109fa0e5ab78f04f81f5493f181fd6326e1ebac Mon Sep 17 00:00:00 2001 From: Kohei Takahashi Date: Wed, 17 Feb 2016 08:10:30 +0900 Subject: [PATCH] Add tests for nested map and set. --- test/Jamfile | 2 ++ test/sequence/map_nest.cpp | 71 ++++++++++++++++++++++++++++++++++++++ test/sequence/set_nest.cpp | 64 ++++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 test/sequence/map_nest.cpp create mode 100644 test/sequence/set_nest.cpp diff --git a/test/Jamfile b/test/Jamfile index 93f8914c..0583d60b 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -116,12 +116,14 @@ project [ run sequence/map_misc.cpp ] [ run sequence/map_move.cpp ] [ run sequence/map_mutate.cpp ] + [ run sequence/map_nest.cpp ] [ run sequence/map_tie.cpp ] [ run sequence/nil.cpp ] [ run sequence/nview.cpp ] [ run sequence/reverse_view.cpp ] [ run sequence/segmented_iterator_range.cpp ] [ run sequence/set.cpp ] + [ run sequence/set_nest.cpp ] [ run sequence/single_view.cpp ] [ run sequence/std_pair.cpp ] [ run sequence/boost_array.cpp ] diff --git a/test/sequence/map_nest.cpp b/test/sequence/map_nest.cpp new file mode 100644 index 00000000..1ca23ba0 --- /dev/null +++ b/test/sequence/map_nest.cpp @@ -0,0 +1,71 @@ +/*============================================================================= + Copyright (C) 2016 Kohei Takahshi + + Distributed under 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 + +template +void test_copy() +{ + C src; + C dst = src; + (void)dst; +} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template +void test_move() +{ + C src; + C dst = std::move(src); + (void)dst; +} +#endif + +template +void test_all() +{ + test_copy(); +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + test_move(); +#endif +} + +struct k1; +struct k2; +struct k3; +struct k4; + +void +test() +{ + using namespace boost::fusion; + + test_all > > >(); + test_all >, pair > >(); + test_all, pair > > >(); + test_all, pair >, pair > >(); + + test_all > > > >(); + test_all > >, pair > >(); + test_all, pair > > > >(); + test_all, pair > >, pair > >(); + + test_all, pair > > > >(); + test_all, pair > >, pair > >(); + test_all, map, pair > > >(); + test_all, map, pair >, pair > >(); +} + +int +main() +{ + test(); + return boost::report_errors(); +} + diff --git a/test/sequence/set_nest.cpp b/test/sequence/set_nest.cpp new file mode 100644 index 00000000..aa8f73aa --- /dev/null +++ b/test/sequence/set_nest.cpp @@ -0,0 +1,64 @@ +/*============================================================================= + Copyright (C) 2016 Kohei Takahshi + + Distributed under 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 + +template +void test_copy() +{ + C src; + C dst = src; + (void)dst; +} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template +void test_move() +{ + C src; + C dst = std::move(src); + (void)dst; +} +#endif + +template +void test_all() +{ + test_copy(); +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + test_move(); +#endif +} + +void +test() +{ + using namespace boost::fusion; + + test_all > >(); + test_all, int> >(); + test_all > >(); + test_all, float> >(); + + test_all > >(); + test_all, int> >(); + test_all > >(); + test_all, float> >(); + + test_all, float> >(); + test_all, float, int> >(); +} + +int +main() +{ + test(); + return boost::report_errors(); +} +