1 // Copyright (c) 2019Robert Ramey
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See
4 // accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 #include <boost/safe_numerics/safe_integer.hpp>
8 #include <boost/safe_numerics/native.hpp>
9
10 #include "test_subtract_native_results.hpp"
11
12 template <class T>
13 using safe_t = boost::safe_numerics::safe<
14 T,
15 boost::safe_numerics::native
16 >;
17
18 #include "test_subtract_constexpr.hpp"
19
20 using namespace boost::mp11;
21
22 #include <boost/mp11/list.hpp>
23 #include <boost/mp11/algorithm.hpp>
24
25 template<typename First, typename Second>
26 struct test_pair {
27 static const std::size_t i = First();
28 static const std::size_t j = Second();
29 constexpr static const bool value = test_subtract_constexpr(
30 mp_at_c<test_values, i>()(),
31 mp_at_c<test_values, j>()(),
32 test_subtraction_native_result[i][j]
33 );
34 };
35
main()36 int main(){
37 using namespace boost::mp11;
38
39 using value_indices = mp_iota_c<mp_size<test_values>::value>;
40
41 static_assert(
42 mp_all_of<
43 mp_product<
44 test_pair,
45 value_indices,
46 value_indices
47 >,
48 mp_to_bool
49 >(),
50 "all values for all integer types correctly subtracted"
51 );
52 return 0;
53 }
54