diff --git a/include/duckhandy/implem/int_conv.hpp b/include/duckhandy/implem/int_conv.hpp index 7d717be..276238d 100644 --- a/include/duckhandy/implem/int_conv.hpp +++ b/include/duckhandy/implem/int_conv.hpp @@ -286,7 +286,7 @@ namespace dhandy { } }; template - using ASCIITranslatorUpcase = ASCIITranslator; + using ASCIITranslatorUpcase = ASCIITranslator; template > constexpr inline auto int_to_ary (I in) { diff --git a/test/unit/int_conv_test.cpp b/test/unit/int_conv_test.cpp index 26be172..6145328 100644 --- a/test/unit/int_conv_test.cpp +++ b/test/unit/int_conv_test.cpp @@ -34,6 +34,12 @@ namespace { using AryConversion = dhandy::implem::AryConversion>; CHECK(AryConversion::from_ary(s.data(), s.data() + s.size()) == expected); } + + template + void AryConversionTestHelperUp (const std::string_view& s, T expected) { + using AryConversion = dhandy::implem::AryConversion>; + CHECK(AryConversion::from_ary(s.data(), s.data() + s.size()) == expected); + } } //unnamed namespace TEST_CASE ("Check int to char array conversions", "[s2i][int_conv]") { @@ -74,6 +80,7 @@ TEST_CASE ("Check int to char array conversions", "[s2i][int_conv]") { CHECK(int_to_ary(-1) == "-1"); CHECK(int_to_ary(0x1000000000000000) == "1152921504606846976"); CHECK(int_to_ary(0xF000000000000000) == "-1152921504606846976"); + CHECK(int_to_ary>(255) == "FF"); CHECK(int_to_ary(0xFFFF) == "ffff"); CHECK(int_to_ary(0xCACA) == "caca"); @@ -155,6 +162,7 @@ TEST_CASE ("Check char array to int conversions", "[i2s][int_conv]") { AryConversionTestHelper("7fffffff", 0x7fffffff); AryConversionTestHelper("1", true); AryConversionTestHelper("0", false); + AryConversionTestHelperUp("ABCDEF123456ABCD", 0xabcdef123456abcd); AryConversionTestHelper("-1", -1); AryConversionTestHelper("-50000", -50000);