diff --git a/test/mpl.cpp b/test/mpl.cpp new file mode 100755 index 0000000..7f9ab12 --- /dev/null +++ b/test/mpl.cpp @@ -0,0 +1,88 @@ +// Copyright David Abrahams 2006. 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 "basics.hpp" +#include +#include +#include +#include +#include + +# include +# include +# include + +namespace test +{ + namespace mpl = boost::mpl; + + template + struct assert_in_set + { + template + void operator()(T*) + { +#if 1 // mpl::set is too unreliable in this release. + typedef typename mpl::find::type pos; + typedef typename mpl::end::type not_found; + BOOST_MPL_ASSERT_NOT((boost::is_same)); +#else + BOOST_MPL_ASSERT((mpl::has_key)); +#endif + } + }; + + + template + void f_impl(Params const& p BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected)) + { + BOOST_MPL_ASSERT_RELATION( + mpl::size::value + , == + , mpl::size::value + ); + + mpl::for_each >(assert_in_set()); + } + + template + void f(Tester const& t, const Name& name_, + const Value& value_, const Index& index_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected)) + { + f_impl(f_parameters()(t, name_, value_, index_)); + } + + template + void f(Tester const& t, const Name& name_, const Value& value_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected)) + { + f_impl(f_parameters()(t, name_, value_)); + } + + template + void f(Tester const& t, const Name& name_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected)) + { + f_impl(f_parameters()(t, name_)); + } + + + void run() + { + typedef test::tag::tester tester_; + typedef test::tag::name name_; + typedef test::tag::value value_; + typedef test::tag::index index_; + + f >(1, 2, 3, 4); + f >(1, 2, index = 3); + f >(1, index = 2, name = 3); + f >(name = 3, value = 4); + } +} + +int main() +{ + test::run(); + return 0; +} +