// Range v3 library // // Copyright Eric Niebler 2019-present // // Use, modification and distribution is subject to 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) // // Project home: https://github.com/ericniebler/range-v3 #include #include "../simple_test.hpp" #include "../test_utils.hpp" #include #include using ranges::detail::diffmax_t; template class Op> void check_1(std::ptrdiff_t a, std::ptrdiff_t b) { // std::cout << std::dec; // std::cout << a << "&" << b << " == " << (a&b) << std::endl; // std::cout << std::hex; // std::cout << a << "&" << b << " == " << (a&b) << std::endl; CHECK(Op{}(a, b) == Op{}(a, b)); } template<> void check_1(std::ptrdiff_t a, std::ptrdiff_t b) { if(b) CHECK(std::divides{}(a, b) == std::divides{}(a, b)); } template<> void check_1(std::ptrdiff_t a, std::ptrdiff_t b) { if(b) CHECK(std::modulus{}(a, b) == std::modulus{}(a, b)); } template class Op> void check() { check_1(0, 0); check_1(-1, 0); check_1(0, -1); check_1(1, 0); check_1(0, 1); check_1(1, 1); check_1(-1, -1); check_1(-5, -4); check_1(-4, -5); check_1(5, -4); check_1(-4, 5); check_1(-5, 4); check_1(4, -5); } int main() { check(); check(); check(); check(); check(); check(); check(); check(); return test_result(); }