summaryrefslogtreecommitdiff
path: root/test/util/string.test.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-10-17 15:45:35 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-10-23 12:23:40 +0200
commitdecbde16165cf3e4455edd0c5caeac991d0c01e6 (patch)
tree3acadad0daeb1ec134fc872e1a90eac2d1e86325 /test/util/string.test.cpp
parentea51b11dccdc117c7dc43ffd3b3d0f969f59799f (diff)
downloadqtlocation-mapboxgl-decbde16165cf3e4455edd0c5caeac991d0c01e6.tar.gz
[core] deduplicate dtoa() from RapidJSON and add tests
Diffstat (limited to 'test/util/string.test.cpp')
-rw-r--r--test/util/string.test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/util/string.test.cpp b/test/util/string.test.cpp
new file mode 100644
index 0000000000..06e6ca9e9e
--- /dev/null
+++ b/test/util/string.test.cpp
@@ -0,0 +1,13 @@
+#include <mbgl/test/util.hpp>
+
+#include <mbgl/util/string.hpp>
+
+using namespace mbgl;
+
+TEST(ToString, FloatingPoint) {
+ EXPECT_EQ("0", util::toString(0.0));
+ EXPECT_EQ("1.33", util::toString(1.33));
+ EXPECT_EQ("-1", util::toString(-1.0));
+ EXPECT_EQ("12340000000", util::toString(12340000000.0));
+ EXPECT_EQ("12340000000", util::toString(12340000000.0));
+}