From 2c647d87d492bea4400e95cf71c2de7270e2f3ab Mon Sep 17 00:00:00 2001 From: psykose Date: Sun, 23 Jun 2024 08:21:42 +0200 Subject: [PATCH] fix building tests when char is unsigned when char is unsigned it's uint8_t which doesn't match the type declared for the key of the map, so it fails with error: non-constant-expression cannot be narrowed from type 'typename std::enable_if::value && sizeof(char) == sizeof(char), char>::type' (aka 'char') to 'const signed char' in initializer list etc --- unittests/map.hpp | 2 +- unittests/multimap.hpp | 2 +- unittests/unordered_map.hpp | 2 +- unittests/unordered_multimap.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unittests/map.hpp b/unittests/map.hpp index 5a91509b..e44a5f47 100644 --- a/unittests/map.hpp +++ b/unittests/map.hpp @@ -62,7 +62,7 @@ void test_map() std::map o_esplmap; for(int j=0; j<100; ++j) - o_esplmap.insert({random_value(gen), { random_value(gen), random_value(gen) }}); + o_esplmap.insert({random_value(gen), { random_value(gen), random_value(gen) }}); std::ostringstream os; { diff --git a/unittests/multimap.hpp b/unittests/multimap.hpp index 0e74b1b8..cc0f50bf 100644 --- a/unittests/multimap.hpp +++ b/unittests/multimap.hpp @@ -71,7 +71,7 @@ void test_multimap() std::multimap o_esplmultimap; for(int j=0; j<100; ++j) { - auto key = random_value(gen); + auto key = random_value(gen); o_esplmultimap.insert({key, { random_value(gen), random_value(gen) }}); o_esplmultimap.insert({key, { random_value(gen), random_value(gen) }}); } diff --git a/unittests/unordered_map.hpp b/unittests/unordered_map.hpp index cc50e788..aa307b37 100644 --- a/unittests/unordered_map.hpp +++ b/unittests/unordered_map.hpp @@ -54,7 +54,7 @@ void test_unordered_map() std::unordered_map o_esplunordered_map; for(int j=0; j<100; ++j) - o_esplunordered_map.insert({random_value(gen), { random_value(gen), random_value(gen) }}); + o_esplunordered_map.insert({random_value(gen), { random_value(gen), random_value(gen) }}); std::ostringstream os; { diff --git a/unittests/unordered_multimap.hpp b/unittests/unordered_multimap.hpp index d5d76bc4..5b3048e8 100644 --- a/unittests/unordered_multimap.hpp +++ b/unittests/unordered_multimap.hpp @@ -71,7 +71,7 @@ void test_unordered_multimap() std::unordered_multimap o_esplunordered_multimap; for(int j=0; j<100; ++j) { - auto key = random_value(gen); + auto key = random_value(gen); o_esplunordered_multimap.insert({key, { random_value(gen), random_value(gen) }}); o_esplunordered_multimap.insert({key, { random_value(gen), random_value(gen) }}); }