]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/integer/test/gcd_constexpr14_test.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / integer / test / gcd_constexpr14_test.cpp
1
2 // (C) Copyright John Maddock 2017.
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/integer/common_factor.hpp>
8
9 #ifndef BOOST_NO_CXX14_CONSTEXPR
10
11 void test_constexpr1()
12 {
13 constexpr const boost::int64_t i = 347 * 463 * 727;
14 constexpr const boost::int64_t j = 191 * 347 * 281;
15
16 constexpr const boost::int64_t k = boost::integer::gcd(i, j);
17 constexpr const boost::int64_t l = boost::integer::lcm(i, j);
18
19 static_assert(k == 347, "Expected result not integer in constexpr gcd.");
20 static_assert(l == 6268802158037, "Expected result not integer in constexpr lcm.");
21 }
22
23 void test_constexpr2()
24 {
25 constexpr const boost::uint64_t i = 347 * 463 * 727;
26 constexpr const boost::uint64_t j = 191 * 347 * 281;
27
28 constexpr const boost::uint64_t k = boost::integer::gcd(i, j);
29 constexpr const boost::uint64_t l = boost::integer::lcm(i, j);
30
31 static_assert(k == 347, "Expected result not integer in constexpr gcd.");
32 static_assert(l == 6268802158037, "Expected result not integer in constexpr lcm.");
33 }
34
35 void test_constexpr3()
36 {
37 constexpr const boost::uint64_t i = 347 * 463 * 727;
38 constexpr const boost::uint64_t j = 191 * 347 * 281;
39
40 constexpr const boost::uint64_t k = boost::integer::gcd_detail::Euclid_gcd(i, j);
41
42 static_assert(k == 347, "Expected result not integer in constexpr gcd.");
43 }
44
45 void test_constexpr4()
46 {
47 constexpr const boost::uint64_t i = 347 * 463 * 727;
48 constexpr const boost::uint64_t j = 191 * 347 * 281;
49
50 constexpr const boost::uint64_t k = boost::integer::gcd_detail::mixed_binary_gcd(i, j);
51
52 static_assert(k == 347, "Expected result not integer in constexpr gcd.");
53 }
54
55 void test_constexpr5()
56 {
57 constexpr const boost::uint64_t i = 347 * 463 * 727;
58 constexpr const boost::uint64_t j = 191 * 347 * 281;
59
60 constexpr const boost::uint64_t k = boost::integer::gcd_detail::Stein_gcd(i, j);
61
62 static_assert(k == 347, "Expected result not integer in constexpr gcd.");
63 }
64 #endif
65
66