Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / test / assert / commas.cpp
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5 #include <boost/hana/assert.hpp>
6
7 #include <support/cnumeric.hpp>
8 namespace hana = boost::hana;
9
10
11 // This test makes sure that we can use conditions with multiple comma-separated
12 // arguments to the non-MSG versions of the BOOST_HANA_XXX_ASSERT macros.
13
14 template <bool value, typename ...>
15 bool runtime_bool() { return value; }
16
17 template <bool value, typename ...>
18 auto constant_bool() { return make_cnumeric<bool, value>(); }
19
20 int main() {
21     BOOST_HANA_CONSTANT_ASSERT(constant_bool<true, void>());
22     BOOST_HANA_CONSTANT_ASSERT(constant_bool<true, void, void>());
23     BOOST_HANA_CONSTANT_ASSERT(constant_bool<true, void, void, void>());
24
25     BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true, void>());
26     BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true, void, void>());
27     BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true, void, void, void>());
28
29     BOOST_HANA_ASSERT(runtime_bool<true, void>());
30     BOOST_HANA_ASSERT(runtime_bool<true, void, void>());
31     BOOST_HANA_ASSERT(runtime_bool<true, void, void, void>());
32     BOOST_HANA_ASSERT(constant_bool<true, void>());
33     BOOST_HANA_ASSERT(constant_bool<true, void, void>());
34     BOOST_HANA_ASSERT(constant_bool<true, void, void, void>());
35 }