From 4420d22185b76b09c18c6624df926553ac126999 Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Fri, 31 Jan 2020 00:35:19 +0300 Subject: [PATCH] Review fixes. --- ge0/ge0_tests/parser_tests.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ge0/ge0_tests/parser_tests.cpp b/ge0/ge0_tests/parser_tests.cpp index 74a9f25f13..000b811a35 100644 --- a/ge0/ge0_tests/parser_tests.cpp +++ b/ge0/ge0_tests/parser_tests.cpp @@ -3,6 +3,8 @@ #include "ge0/parser.hpp" #include "ge0/url_generator.hpp" +#include "base/math.hpp" + #include #include @@ -62,14 +64,17 @@ void TestFailure(char const * s) { Ge0Parser parser; string name; - double lat, lon, zoomLevel; + double lat; + double lon; + double zoomLevel; bool const result = parser.Parse(s, lat, lon, name, zoomLevel); TEST(!result, (s)); } bool ConvergenceTest(double lat, double lon, double latEps, double lonEps) { - double tmpLat = lat, tmpLon = lon; + double tmpLat = lat; + double tmpLon = lon; Ge0ParserForTest parser; for (size_t i = 0; i < 100000; ++i) { @@ -77,9 +82,7 @@ bool ConvergenceTest(double lat, double lon, double latEps, double lonEps) ge0::LatLonToString(tmpLat, tmpLon, urlPrefix + 0, 9); parser.DecodeLatLon(urlPrefix, tmpLat, tmpLon); } - if (fabs(lat - tmpLat) <= latEps && fabs(lon - tmpLon) <= lonEps) - return true; - return false; + return base::AlmostEqualAbs(lat, tmpLat, latEps) && base::AlmostEqualAbs(lon, tmpLon, lonEps); } UNIT_TEST(Base64DecodingWorksForAValidChar)