diff --git a/test/algorithms/azimuth.cpp b/test/algorithms/azimuth.cpp index 98db9e255..541884771 100644 --- a/test/algorithms/azimuth.cpp +++ b/test/algorithms/azimuth.cpp @@ -15,10 +15,23 @@ #include -template -void test_one(P const& p1, P const& p2, double expected) + +template +auto call_azimuth(P const& p1, P const& p2, S const& s) { - double const result = bg::azimuth(p1, p2) * bg::math::r2d(); + return bg::azimuth(p1, p2, s); +} + +template +auto call_azimuth(P const& p1, P const& p2, bg::default_strategy const&) +{ + return bg::azimuth(p1, p2); +} + +template +void test_one(P const& p1, P const& p2, double expected, S const& s = S()) +{ + double const result = call_azimuth(p1, p2, s) * bg::math::r2d(); BOOST_CHECK_CLOSE(result, expected, 0.0001); } @@ -52,11 +65,24 @@ void test_geo() test_one(P(0, 0), P(-100, 1), -88.986933066023497); } +template +void test_geo_v() +{ + bg::strategies::azimuth::geographic s; + + test_one(P(0, 0), P(0, 0), 0, s); + test_one(P(0, 0), P(1, 1), 45.188040229339755, s); + test_one(P(0, 0), P(100, 1), 88.986914518230208, s); + test_one(P(0, 0), P(-1, 1), -45.188040229339755, s); + test_one(P(0, 0), P(-100, 1), -88.986914518230208, s); +} + int test_main(int, char* []) { test_car< bg::model::point >(); test_sph< bg::model::point > >(); test_geo< bg::model::point > >(); + test_geo_v< bg::model::point > >(); return 0; }