summaryrefslogtreecommitdiff
path: root/test/util
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-10-17 15:56:55 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-10-23 12:23:40 +0200
commiteb828dfd2959f85191a452ced1532d39f6473ccb (patch)
treee44d1512b892ec88064fdfd4865cc61252018123 /test/util
parent43687b4781cdcd7c4e299dc625263bc3982a529f (diff)
downloadqtlocation-mapboxgl-eb828dfd2959f85191a452ced1532d39f6473ccb.tar.gz
[core] add the ability to stringy numbers as hex
Diffstat (limited to 'test/util')
-rw-r--r--test/util/string.test.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/util/string.test.cpp b/test/util/string.test.cpp
index 08e8e9f759..91e1b93685 100644
--- a/test/util/string.test.cpp
+++ b/test/util/string.test.cpp
@@ -2,6 +2,8 @@
#include <mbgl/util/string.hpp>
+#include <cstdint>
+
using namespace mbgl;
TEST(ToString, FloatingPoint) {
@@ -16,3 +18,12 @@ TEST(ToString, FloatingPoint) {
EXPECT_EQ("12340000000", util::toString(12340000000.0));
EXPECT_EQ("12340000000.0", util::toString(12340000000.0, true));
}
+
+TEST(ToHex, SIZE_T) {
+#if INTPTR_MAX == INT32_MAX
+ EXPECT_EQ("a715b247", util::toHex((size_t)0xa715b247));
+#elif INTPTR_MAX == INT64_MAX
+ EXPECT_EQ("a715b247df38cc29", util::toHex((size_t)0xa715b247df38cc29));
+#endif
+
+}