diff options
author | vng <viktor.govako@gmail.com> | 2011-05-12 00:39:10 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:17:15 +0300 |
commit | 95269ed597c7f3d0db850cfd48cb0ef869eabc47 (patch) | |
tree | 9d526a4c3752d305cb48166e478c68918ba1c512 /geometry | |
parent | f322c7e47f9717e2d418608441df9e7be426aea4 (diff) |
Fix compilation errors for msvc.
Diffstat (limited to 'geometry')
-rw-r--r-- | geometry/geometry_tests/aarect_test.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/geometry/geometry_tests/aarect_test.cpp b/geometry/geometry_tests/aarect_test.cpp index 4f35cc2943..2f7960921c 100644 --- a/geometry/geometry_tests/aarect_test.cpp +++ b/geometry/geometry_tests/aarect_test.cpp @@ -1,19 +1,24 @@ #include "../../base/SRC_FIRST.hpp" + #include "../../testing/testing.hpp" + #include "../aa_rect2d.hpp" +#include "../../std/cmath.hpp" + UNIT_TEST(AARect_TestConvertTo) { m2::AARectD r(m2::PointD(0, 0), math::pi / 4, m2::RectD(0, 0, 10, 10)); m2::PointD pt1(100, 0); - TEST(r.ConvertTo(pt1).EqualDxDy(m2::PointD(100 / sqrt(2), -100 / sqrt(2)), 10e-5), ()); - TEST(r.ConvertTo(m2::PointD(100, 100)).EqualDxDy(m2::PointD(100 * sqrt(2), 0), 10e-5), ()); + double const sqrt2 = sqrt(2.0); + TEST(r.ConvertTo(pt1).EqualDxDy(m2::PointD(100 / sqrt2, -100 / sqrt2), 10e-5), ()); + TEST(r.ConvertTo(m2::PointD(100, 100)).EqualDxDy(m2::PointD(100 * sqrt2, 0), 10e-5), ()); m2::AARectD r1(m2::PointD(100, 100), math::pi / 4, m2::RectD(0, 0, 10, 10)); - m2::PointD pt(100, 100 + 50 * sqrt(2)); + m2::PointD pt(100, 100 + 50 * sqrt2); TEST(r1.ConvertTo(pt).EqualDxDy(m2::PointD(50, 50), 10e-5), ()); } @@ -22,8 +27,9 @@ UNIT_TEST(AARect_TestConvertFrom) { m2::AARectD r(m2::PointD(100, 100), math::pi / 6, m2::RectD(0, 0, 10, 10)); - TEST(r.ConvertFrom(m2::PointD(50, 0)).EqualDxDy(m2::PointD(100 + 50 * sqrt(3) / 2 , 100 + 50 * 1 / 2.0), 10e-5), ()); - TEST(r.ConvertTo(m2::PointD(100 + 50 * sqrt(3) / 2, 100 + 50 * 1.0 / 2)).EqualDxDy(m2::PointD(50, 0), 10e-5), ()); + double const sqrt3 = sqrt(3.0); + TEST(r.ConvertFrom(m2::PointD(50, 0)).EqualDxDy(m2::PointD(100 + 50 * sqrt3 / 2 , 100 + 50 * 1 / 2.0), 10e-5), ()); + TEST(r.ConvertTo(m2::PointD(100 + 50 * sqrt3 / 2, 100 + 50 * 1.0 / 2)).EqualDxDy(m2::PointD(50, 0), 10e-5), ()); } UNIT_TEST(AARect_TestIntersection) |