]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/integer/test/gcd_constexpr14_test.cpp
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 // https://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/integer/common_factor.hpp>
9 #ifndef BOOST_NO_CXX14_CONSTEXPR
11 void test_constexpr1()
13 constexpr const boost::int64_t i
= 347 * 463 * 727;
14 constexpr const boost::int64_t j
= 191 * 347 * 281;
16 constexpr const boost::int64_t k
= boost::integer::gcd(i
, j
);
17 constexpr const boost::int64_t l
= boost::integer::lcm(i
, j
);
19 static_assert(k
== 347, "Expected result not integer in constexpr gcd.");
20 static_assert(l
== 6268802158037, "Expected result not integer in constexpr lcm.");
23 void test_constexpr2()
25 constexpr const boost::uint64_t i
= 347 * 463 * 727;
26 constexpr const boost::uint64_t j
= 191 * 347 * 281;
28 constexpr const boost::uint64_t k
= boost::integer::gcd(i
, j
);
29 constexpr const boost::uint64_t l
= boost::integer::lcm(i
, j
);
31 static_assert(k
== 347, "Expected result not integer in constexpr gcd.");
32 static_assert(l
== 6268802158037, "Expected result not integer in constexpr lcm.");
35 void test_constexpr3()
37 constexpr const boost::uint64_t i
= 347 * 463 * 727;
38 constexpr const boost::uint64_t j
= 191 * 347 * 281;
40 constexpr const boost::uint64_t k
= boost::integer::gcd_detail::Euclid_gcd(i
, j
);
42 static_assert(k
== 347, "Expected result not integer in constexpr gcd.");
45 void test_constexpr4()
47 constexpr const boost::uint64_t i
= 347 * 463 * 727;
48 constexpr const boost::uint64_t j
= 191 * 347 * 281;
50 constexpr const boost::uint64_t k
= boost::integer::gcd_detail::mixed_binary_gcd(i
, j
);
52 static_assert(k
== 347, "Expected result not integer in constexpr gcd.");
55 void test_constexpr5()
57 constexpr const boost::uint64_t i
= 347 * 463 * 727;
58 constexpr const boost::uint64_t j
= 191 * 347 * 281;
60 constexpr const boost::uint64_t k
= boost::integer::gcd_detail::Stein_gcd(i
, j
);
62 static_assert(k
== 347, "Expected result not integer in constexpr gcd.");