diff --git a/test/Jamfile b/test/Jamfile index 79c4eaf..5e4bc90 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -146,6 +146,7 @@ run mp_nth_element_q.cpp ; run mp_back.cpp ; run mp_back_2.cpp ; run mp_pop_back.cpp ; +run mp_pop_back_2.cpp ; run mp_flatten.cpp ; run mp_rotate_left.cpp ; run mp_rotate_right.cpp ; diff --git a/test/mp_pop_back_2.cpp b/test/mp_pop_back_2.cpp new file mode 100644 index 0000000..1061a38 --- /dev/null +++ b/test/mp_pop_back_2.cpp @@ -0,0 +1,54 @@ +// Copyright 2023 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include + +#if !defined(BOOST_MP11_HAS_TEMPLATE_AUTO) + +#pragma message("Test skipped because BOOST_MP11_HAS_TEMPLATE_AUTO is not defined") +int main() {} + +#else + +#include + +template struct V1 {}; +template struct V2 {}; + +int main() +{ + using boost::mp11::mp_pop_back; + + using L1 = V1; + BOOST_TEST_TRAIT_SAME(mp_pop_back, V1<>); + + using L2 = V1; + BOOST_TEST_TRAIT_SAME(mp_pop_back, V1); + + using L3 = V2<0>; + BOOST_TEST_TRAIT_SAME(mp_pop_back, V2<>); + + using L4 = V2<0, 1, 2, 3, 4, 5, 6, 7, 8, 9>; + BOOST_TEST_TRAIT_SAME(mp_pop_back, V2<0, 1, 2, 3, 4, 5, 6, 7, 8>); + + using boost::mp11::mp_iota_c; + using boost::mp11::mp_rename_v; + + int const N = 137; + + using L6 = mp_rename_v, V1>; + using L7 = mp_rename_v, V1>; + BOOST_TEST_TRAIT_SAME(mp_pop_back, L7); + + using boost::mp11::mp_valid; + + using L8 = V2<>; + BOOST_TEST_TRAIT_FALSE((mp_valid)); + + return boost::report_errors(); +} + +#endif