Add support for constexpr string_view creation
This commit is contained in:
parent
e62da38cf9
commit
422b475ce3
3 changed files with 74 additions and 21 deletions
|
@ -171,3 +171,27 @@ TEST_CASE ("Check char array to int conversions", "[i2s][int_conv]") {
|
|||
AryConversionTestHelper<std::int64_t, 10>("-1", -1, false);
|
||||
AryConversionTestHelper<std::int64_t, 10>("-510123123123", -510123123123, false);
|
||||
}
|
||||
|
||||
TEST_CASE ("Check upcase/downcase int to array conversions", "[i2s][int_conv]") {
|
||||
using dhandy::int_conv;
|
||||
using std::string_view;
|
||||
using std::integral_constant;
|
||||
|
||||
constexpr auto bool1 = int_conv<string_view>(integral_constant<bool, true>{});
|
||||
CHECK("1" == bool1);
|
||||
|
||||
constexpr auto bool2 = int_conv<string_view>(integral_constant<bool, false>{});
|
||||
CHECK("0" == bool2);
|
||||
|
||||
constexpr auto int1 = int_conv<string_view>(integral_constant<int, 42>{});
|
||||
CHECK("42" == int1);
|
||||
|
||||
constexpr auto int2 = int_conv<string_view>(integral_constant<unsigned int, 7777777>{});
|
||||
CHECK("7777777" == int2);
|
||||
|
||||
constexpr auto int3 = int_conv<string_view>(integral_constant<int, -1234>{});
|
||||
CHECK("-1234" == int3);
|
||||
|
||||
constexpr auto int4 = int_conv<string_view>(integral_constant<short int, -256>{});
|
||||
CHECK("-256" == int4);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue