Skip to content

Commit 2c647d8

Browse files
nekopsykoseAzothAmmo
authored andcommitted
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<std::is_integral<char>::value && sizeof(char) == sizeof(char), char>::type' (aka 'char') to 'const signed char' in initializer list etc
1 parent f7deca3 commit 2c647d8

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

unittests/map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void test_map()
6262

6363
std::map<int8_t, StructExternalSplit> o_esplmap;
6464
for(int j=0; j<100; ++j)
65-
o_esplmap.insert({random_value<char>(gen), { random_value<int>(gen), random_value<int>(gen) }});
65+
o_esplmap.insert({random_value<int8_t>(gen), { random_value<int>(gen), random_value<int>(gen) }});
6666

6767
std::ostringstream os;
6868
{

unittests/multimap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void test_multimap()
7171
std::multimap<int8_t, StructExternalSplit> o_esplmultimap;
7272
for(int j=0; j<100; ++j)
7373
{
74-
auto key = random_value<char>(gen);
74+
auto key = random_value<int8_t>(gen);
7575
o_esplmultimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
7676
o_esplmultimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
7777
}

unittests/unordered_map.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void test_unordered_map()
5454

5555
std::unordered_map<int8_t, StructExternalSplit> o_esplunordered_map;
5656
for(int j=0; j<100; ++j)
57-
o_esplunordered_map.insert({random_value<char>(gen), { random_value<int>(gen), random_value<int>(gen) }});
57+
o_esplunordered_map.insert({random_value<int8_t>(gen), { random_value<int>(gen), random_value<int>(gen) }});
5858

5959
std::ostringstream os;
6060
{

unittests/unordered_multimap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void test_unordered_multimap()
7171
std::unordered_multimap<int8_t, StructExternalSplit> o_esplunordered_multimap;
7272
for(int j=0; j<100; ++j)
7373
{
74-
auto key = random_value<char>(gen);
74+
auto key = random_value<int8_t>(gen);
7575
o_esplunordered_multimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
7676
o_esplunordered_multimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
7777
}

0 commit comments

Comments
 (0)