Fix: FormatArrayAsHex returns gibberish instead of a hex array

This commit is contained in:
Rubidium
2023-04-27 23:14:01 +02:00
committed by rubidium42
parent 3991e76c96
commit b5f96808a1
2 changed files with 13 additions and 4 deletions

View File

@@ -12,6 +12,7 @@
#include "../3rdparty/catch2/catch.hpp"
#include "../string_func.h"
#include <array>
/**** String compare/equals *****/
@@ -516,3 +517,11 @@ TEST_CASE("StrEndsWithIgnoreCase - std::string_view")
CHECK(!StrEndsWithIgnoreCase(base.substr(2, 1), base.substr(0, 1)));
CHECK(!StrEndsWithIgnoreCase(base.substr(0, 1), base.substr(0, 2)));
}
TEST_CASE("FormatArrayAsHex")
{
CHECK(FormatArrayAsHex(std::array<byte, 0>{}) == "");
CHECK(FormatArrayAsHex(std::array<byte, 1>{0x12}) == "12");
CHECK(FormatArrayAsHex(std::array<byte, 4>{0x13, 0x38, 0x42, 0xAF}) == "133842AF");
}