// Copyright (c) 2012 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 #include #include #include "test_add_native_results.hpp" template using safe_t = boost::safe_numerics::safe< T, boost::safe_numerics::native >; #include "test_add.hpp" #include #include #include using namespace boost::mp11; template struct test { static_assert(mp_is_list(), "must be a list of integral constants"); bool m_error; test(bool b = true) : m_error(b) {} operator bool(){ return m_error; } template void operator()(const T &){ static_assert(mp_is_list(), "must be a list of two integral constants"); constexpr size_t i1 = mp_first(); // index of first argument constexpr size_t i2 = mp_second();// index of second argument std::cout << i1 << ',' << i2 << ','; using T1 = typename mp_at_c::value_type; using T2 = typename mp_at_c::value_type; m_error &= test_add( mp_at_c()(), // value of first argument mp_at_c()(), // value of second argument boost::core::demangle(typeid(T1).name()).c_str(), boost::core::demangle(typeid(T2).name()).c_str(), test_addition_native_result[i1][i2] ); } }; #include "check_symmetry.hpp" int main(){ // sanity check on test matrix - should be symetrical check_symmetry(test_addition_native_result); test rval(true); using value_indices = mp_iota_c::value>; mp_for_each< mp_product >(rval); std::cout << (rval ? "success!" : "failure") << std::endl; return ! rval ; }