summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-06-21 14:44:00 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-09-11 11:43:54 +0200
commit4a3c4edb59b6881a30056531bc71e52295ab1cb0 (patch)
treeb1c466667efc84cd5f7345d977032155f315ec76 /test
parent30e570aae7d2ba5522feafb962b334ef3f35459e (diff)
downloadqtlocation-mapboxgl-4a3c4edb59b6881a30056531bc71e52295ab1cb0.tar.gz
[android] add support for gnustl
Diffstat (limited to 'test')
-rw-r--r--test/map/transform.test.cpp6
-rw-r--r--test/storage/http_file_source.test.cpp5
-rw-r--r--test/storage/online_file_source.test.cpp5
-rw-r--r--test/util/dtoa.test.cpp26
4 files changed, 23 insertions, 19 deletions
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index 11c2c1cc6b..44b5f49366 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -3,6 +3,8 @@
#include <mbgl/map/transform.hpp>
#include <mbgl/util/geo.hpp>
+#include <cmath>
+
using namespace mbgl;
TEST(Transform, InvalidZoom) {
@@ -15,7 +17,7 @@ TEST(Transform, InvalidZoom) {
transform.setZoom(1);
ASSERT_DOUBLE_EQ(1, transform.getZoom());
- const double invalid = std::nan("");
+ const double invalid = NAN;
transform.setZoom(invalid);
@@ -67,7 +69,7 @@ TEST(Transform, InvalidBearing) {
ASSERT_DOUBLE_EQ(1, transform.getZoom());
ASSERT_DOUBLE_EQ(2, transform.getAngle());
- const double invalid = std::nan("");
+ const double invalid = NAN;
transform.setAngle(invalid);
ASSERT_DOUBLE_EQ(0, transform.getLatLng().latitude());
diff --git a/test/storage/http_file_source.test.cpp b/test/storage/http_file_source.test.cpp
index 006b7a0fb3..42b4174e69 100644
--- a/test/storage/http_file_source.test.cpp
+++ b/test/storage/http_file_source.test.cpp
@@ -2,6 +2,7 @@
#include <mbgl/storage/http_file_source.hpp>
#include <mbgl/util/exception.hpp>
#include <mbgl/util/chrono.hpp>
+#include <mbgl/util/string.hpp>
#include <mbgl/util/run_loop.hpp>
using namespace mbgl;
@@ -177,12 +178,12 @@ TEST(HTTPFileSource, TEST_REQUIRES_SERVER(Load)) {
std::function<void(int)> req = [&](int i) {
const auto current = number++;
reqs[i] = fs.request({ Resource::Unknown,
- std::string("http://127.0.0.1:3000/load/") + std::to_string(current) },
+ std::string("http://127.0.0.1:3000/load/") + util::toString(current) },
[&, i, current](Response res) {
reqs[i].reset();
EXPECT_EQ(nullptr, res.error);
ASSERT_TRUE(res.data.get());
- EXPECT_EQ(std::string("Request ") + std::to_string(current), *res.data);
+ EXPECT_EQ(std::string("Request ") + util::toString(current), *res.data);
EXPECT_FALSE(bool(res.expires));
EXPECT_FALSE(res.mustRevalidate);
EXPECT_FALSE(bool(res.modified));
diff --git a/test/storage/online_file_source.test.cpp b/test/storage/online_file_source.test.cpp
index 70bfe3ac95..b5a7c139d3 100644
--- a/test/storage/online_file_source.test.cpp
+++ b/test/storage/online_file_source.test.cpp
@@ -4,6 +4,7 @@
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/timer.hpp>
+#include <mbgl/util/string.hpp>
#include <mbgl/util/constants.hpp>
#include <gtest/gtest.h>
@@ -240,12 +241,12 @@ TEST(OnlineFileSource, TEST_REQUIRES_SERVER(Load)) {
std::function<void(int)> req = [&](int i) {
const auto current = number++;
reqs[i] = fs.request({ Resource::Unknown,
- std::string("http://127.0.0.1:3000/load/") + std::to_string(current) },
+ std::string("http://127.0.0.1:3000/load/") + util::toString(current) },
[&, i, current](Response res) {
reqs[i].reset();
EXPECT_EQ(nullptr, res.error);
ASSERT_TRUE(res.data.get());
- EXPECT_EQ(std::string("Request ") + std::to_string(current), *res.data);
+ EXPECT_EQ(std::string("Request ") + util::toString(current), *res.data);
EXPECT_FALSE(bool(res.expires));
EXPECT_FALSE(res.mustRevalidate);
EXPECT_FALSE(bool(res.modified));
diff --git a/test/util/dtoa.test.cpp b/test/util/dtoa.test.cpp
index 8d2fba1877..ca13a51c40 100644
--- a/test/util/dtoa.test.cpp
+++ b/test/util/dtoa.test.cpp
@@ -8,17 +8,17 @@
using namespace mbgl;
TEST(Dtoa, Precision) {
- EXPECT_EQ(M_E, std::stod(util::dtoa(M_E)));
- EXPECT_EQ(M_LOG2E, std::stod(util::dtoa(M_LOG2E)));
- EXPECT_EQ(M_LOG10E, std::stod(util::dtoa(M_LOG10E)));
- EXPECT_EQ(M_LN2, std::stod(util::dtoa(M_LN2)));
- EXPECT_EQ(M_LN10, std::stod(util::dtoa(M_LN10)));
- EXPECT_EQ(M_PI, std::stod(util::dtoa(M_PI)));
- EXPECT_EQ(M_PI_2, std::stod(util::dtoa(M_PI_2)));
- EXPECT_EQ(M_PI_4, std::stod(util::dtoa(M_PI_4)));
- EXPECT_EQ(M_1_PI, std::stod(util::dtoa(M_1_PI)));
- EXPECT_EQ(M_2_PI, std::stod(util::dtoa(M_2_PI)));
- EXPECT_EQ(M_2_SQRTPI, std::stod(util::dtoa(M_2_SQRTPI)));
- EXPECT_EQ(M_SQRT2, std::stod(util::dtoa(M_SQRT2)));
- EXPECT_EQ(M_SQRT1_2, std::stod(util::dtoa(M_SQRT1_2)));
+ EXPECT_EQ(M_E, util::stod(util::dtoa(M_E)));
+ EXPECT_EQ(M_LOG2E, util::stod(util::dtoa(M_LOG2E)));
+ EXPECT_EQ(M_LOG10E, util::stod(util::dtoa(M_LOG10E)));
+ EXPECT_EQ(M_LN2, util::stod(util::dtoa(M_LN2)));
+ EXPECT_EQ(M_LN10, util::stod(util::dtoa(M_LN10)));
+ EXPECT_EQ(M_PI, util::stod(util::dtoa(M_PI)));
+ EXPECT_EQ(M_PI_2, util::stod(util::dtoa(M_PI_2)));
+ EXPECT_EQ(M_PI_4, util::stod(util::dtoa(M_PI_4)));
+ EXPECT_EQ(M_1_PI, util::stod(util::dtoa(M_1_PI)));
+ EXPECT_EQ(M_2_PI, util::stod(util::dtoa(M_2_PI)));
+ EXPECT_EQ(M_2_SQRTPI, util::stod(util::dtoa(M_2_SQRTPI)));
+ EXPECT_EQ(M_SQRT2, util::stod(util::dtoa(M_SQRT2)));
+ EXPECT_EQ(M_SQRT1_2, util::stod(util::dtoa(M_SQRT1_2)));
}