Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / test / assert / runtime.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 namespace hana = boost::hana;
7
8
9 template <bool value>
10 bool runtime_bool() { return value; }
11
12
13 int main() {
14     // Make sure it works at function scope
15     BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true>());
16     BOOST_HANA_RUNTIME_ASSERT_MSG(runtime_bool<true>(), "message");
17
18     // Make sure we can reference a local variable
19     auto yes = runtime_bool<true>();
20     BOOST_HANA_RUNTIME_ASSERT(yes);
21     BOOST_HANA_RUNTIME_ASSERT_MSG(yes, "message");
22 }