// Boost.Geometry // Unit Test // Copyright (c) 2022 Barend Gehrels, Amsterdam, the Netherlands. // 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) #include #include #include #include #include template void test_side_straight(P const &input_p1, P const &input_p2) { using bg::strategy::buffer::side_straight; bg::strategy::buffer::distance_symmetric::type> ds(1.0); std::vector

output_range; auto const result = side_straight::apply(input_p1, input_p2, bg::strategy::buffer::buffer_side_right, ds, output_range); BOOST_CHECK_EQUAL(bg::strategy::buffer::result_normal, result); BOOST_CHECK_EQUAL(2u, output_range.size()); #ifdef BOOST_GEOMETRY_TEST_DEBUG if (output_range.size() == 2) { std::cout << bg::distance(output_range.front(), output_range.back()) << std::endl; } #endif } template void test_all() { // Also test for large coordinates. // For integer coordinates there was an overflow with them (now fixed) test_side_straight(P{0, 0}, P{1, 1}); test_side_straight(P{0, 0}, P{100, 100}); test_side_straight(P{0, 0}, P{10000, 10000}); test_side_straight(P{0, 0}, P{1000000, 1000000}); test_side_straight(P{0, 0}, P{100000000, 100000000}); } int test_main(int, char *[]) { test_all>(); test_all>(); return 0; }