safe_numerics/test/test_or_native_constexpr.cpp
Robert Ramey f49e434238 Add tests for constexpr
improved CMake implementation for testing and development
2019-01-10 11:54:18 -08:00

54 lines
1.2 KiB
C++

// Copyright (c) 2019 Robert Ramey
//
// 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 <boost/safe_numerics/safe_integer.hpp>
#include <boost/safe_numerics/native.hpp>
template <class T>
using safe_t = boost::safe_numerics::safe<
T,
boost::safe_numerics::native
>;
#include "test_or_constexpr.hpp"
#include "test_values.hpp"
using namespace boost::mp11;
template<typename First, typename Second>
struct test_pair {
static const std::size_t i = First();
static const std::size_t j = Second();
constexpr static const bool value = test_or_constexpr(
mp_at_c<test_values, i>()(),
mp_at_c<test_values, j>()(),
'.'
);
};
#include <boost/mp11/list.hpp>
#include <boost/mp11/algorithm.hpp>
int main(){
using namespace boost::mp11;
using value_indices = mp_iota_c<mp_size<test_values>::value>;
static_assert(
mp_all_of<
mp_product<
test_pair,
value_indices,
value_indices
>,
mp_to_bool
>(),
"all values for all integer types correctly or'ed"
);
return 0;
}