From 782894ebfbde281401092bd89b1a2f9cceafc3c9 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 22 Jun 2015 00:10:24 +0300 Subject: [PATCH] Add test for mp_contains. --- test/Jamfile.v2 | 2 +- test/mp_contains.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 test/mp_contains.cpp diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 4cd6c40..eb3e20c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -31,7 +31,7 @@ run mp_transform.cpp : : : $(REQ) ; run mp_fill.cpp : : : $(REQ) ; run mp_count.cpp : : : $(REQ) ; run mp_count_if.cpp : : : $(REQ) ; -#run mp_contains.cpp : : : $(REQ) ; +run mp_contains.cpp : : : $(REQ) ; run mp_repeat.cpp : : : $(REQ) ; # integral diff --git a/test/mp_contains.cpp b/test/mp_contains.cpp new file mode 100644 index 0000000..deef491 --- /dev/null +++ b/test/mp_contains.cpp @@ -0,0 +1,64 @@ + +// Copyright 2015 Peter Dimov. +// +// 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 +#include +#include +#include + +struct X1 {}; +struct X2 {}; +struct X3 {}; + +int main() +{ + using boost::mp_list; + using boost::mp_contains; + using boost::mp_true; + using boost::mp_false; + + { + using L1 = mp_list<>; + + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_false>)); + + using L2 = mp_list; + + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_false>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + } + + { + using L3 = std::tuple<>; + + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_false>)); + + using L4 = std::tuple; + + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_false>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + } + + { + using L5 = std::pair; + + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_false>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_true>)); + } + + return boost::report_errors(); +}