From 641cd6555e243c2b24edf9d557f0caf40e4c7dc0 Mon Sep 17 00:00:00 2001 From: artemp Date: Tue, 13 Dec 2016 16:16:19 +0100 Subject: [PATCH] expand std::hash and operator== test for all types in mapnik::value --- test/unit/core/conversions_test.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/unit/core/conversions_test.cpp b/test/unit/core/conversions_test.cpp index 43592af01..abd3d7f8e 100644 --- a/test/unit/core/conversions_test.cpp +++ b/test/unit/core/conversions_test.cpp @@ -284,16 +284,19 @@ SECTION("to string") { REQUIRE( string2bool("true",val) ); REQUIRE( val == true ); - // mapnik::value hashability + // mapnik::value hash() and operator== works for all T in value + mapnik::transcoder tr("utf8"); using values_container = std::unordered_map; values_container vc; - mapnik::value val2(1); - vc[val2] = 1; - REQUIRE( vc[1] == static_cast(1) ); + mapnik::value keys[5] = {true, 1, 3.14159f, tr.transcode("Мапник"), mapnik::value_null()} ; + for (auto const& k : keys) + { + vc.insert({k, 123456789}); + REQUIRE( vc[k] == 123456789 ); + } // mapnik::value << to ostream std::stringstream s; - mapnik::transcoder tr("utf-8"); mapnik::value_unicode_string ustr = tr.transcode("hello world!"); mapnik::value streamable(ustr); s << streamable;