Skip to content

Commit

Permalink
fix building tests when char is unsigned
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nekopsykose authored and AzothAmmo committed Dec 24, 2024
1 parent f7deca3 commit 2c647d8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion unittests/map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void test_map()

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

std::ostringstream os;
{
Expand Down
2 changes: 1 addition & 1 deletion unittests/multimap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void test_multimap()
std::multimap<int8_t, StructExternalSplit> o_esplmultimap;
for(int j=0; j<100; ++j)
{
auto key = random_value<char>(gen);
auto key = random_value<int8_t>(gen);
o_esplmultimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
o_esplmultimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
}
Expand Down
2 changes: 1 addition & 1 deletion unittests/unordered_map.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void test_unordered_map()

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

std::ostringstream os;
{
Expand Down
2 changes: 1 addition & 1 deletion unittests/unordered_multimap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void test_unordered_multimap()
std::unordered_multimap<int8_t, StructExternalSplit> o_esplunordered_multimap;
for(int j=0; j<100; ++j)
{
auto key = random_value<char>(gen);
auto key = random_value<int8_t>(gen);
o_esplunordered_multimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
o_esplunordered_multimap.insert({key, { random_value<int>(gen), random_value<int>(gen) }});
}
Expand Down

0 comments on commit 2c647d8

Please sign in to comment.