summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-05-10 11:16:44 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-06-01 15:38:01 -0700
commitc0c1028dcf57379db68a87d8d0a1780d9d901fe5 (patch)
tree0f3ee78d092dd8f010f6fe26554480a35b9b35f0 /test
parent7a010df9560e8807b9be938bb5ff7360e8e730a6 (diff)
downloadqtlocation-mapboxgl-c0c1028dcf57379db68a87d8d0a1780d9d901fe5.tar.gz
[core] Add toDouble Conversion method for correctly parsing Lat Lng coordinates
Diffstat (limited to 'test')
-rw-r--r--test/src/mbgl/test/conversion_stubs.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/src/mbgl/test/conversion_stubs.hpp b/test/src/mbgl/test/conversion_stubs.hpp
index e6581c5e53..30395ddb97 100644
--- a/test/src/mbgl/test/conversion_stubs.hpp
+++ b/test/src/mbgl/test/conversion_stubs.hpp
@@ -17,6 +17,7 @@ using ValueMap = std::unordered_map<std::string, Value>;
using ValueVector = std::vector<Value>;
class Value : public mbgl::variant<std::string,
float,
+ double,
bool,
mapbox::util::recursive_wrapper<ValueMap>,
mapbox::util::recursive_wrapper<ValueVector>> {
@@ -90,6 +91,14 @@ inline optional<float> toNumber(const Value& value) {
return {};
}
+
+inline optional<double> toDouble(const Value& value) {
+ if (value.is<double>()) {
+ return value.get<double>();
+ }
+ return {};
+}
+
inline optional<std::string> toString(const Value& value) {
if (value.is<std::string>()) {
return value.get<std::string>();