This commit is contained in:
@ -20,11 +20,8 @@ using namespace IACore;
|
||||
|
||||
IAT_BEGIN_BLOCK(Core, StringOps)
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// 1. Base64 Encoding
|
||||
// -------------------------------------------------------------------------
|
||||
auto test_base64_encode() -> bool {
|
||||
// Case 1: Standard text
|
||||
|
||||
{
|
||||
const String s = "Hello World";
|
||||
const Span<const u8> data(reinterpret_cast<const u8 *>(s.data()), s.size());
|
||||
@ -32,7 +29,6 @@ auto test_base64_encode() -> bool {
|
||||
IAT_CHECK_EQ(encoded, String("SGVsbG8gV29ybGQ="));
|
||||
}
|
||||
|
||||
// Case 2: Padding Logic (1 byte -> 2 pad)
|
||||
{
|
||||
const String s = "M";
|
||||
const Span<const u8> data(reinterpret_cast<const u8 *>(s.data()), s.size());
|
||||
@ -40,7 +36,6 @@ auto test_base64_encode() -> bool {
|
||||
IAT_CHECK_EQ(encoded, String("TQ=="));
|
||||
}
|
||||
|
||||
// Case 3: Padding Logic (2 bytes -> 1 pad)
|
||||
{
|
||||
const String s = "Ma";
|
||||
const Span<const u8> data(reinterpret_cast<const u8 *>(s.data()), s.size());
|
||||
@ -48,7 +43,6 @@ auto test_base64_encode() -> bool {
|
||||
IAT_CHECK_EQ(encoded, String("TWE="));
|
||||
}
|
||||
|
||||
// Case 4: Padding Logic (3 bytes -> 0 pad)
|
||||
{
|
||||
const String s = "Man";
|
||||
const Span<const u8> data(reinterpret_cast<const u8 *>(s.data()), s.size());
|
||||
@ -56,7 +50,6 @@ auto test_base64_encode() -> bool {
|
||||
IAT_CHECK_EQ(encoded, String("TWFu"));
|
||||
}
|
||||
|
||||
// Case 5: Empty
|
||||
{
|
||||
const String encoded = StringOps::encode_base64({});
|
||||
IAT_CHECK(encoded.empty());
|
||||
@ -65,11 +58,8 @@ auto test_base64_encode() -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// 2. Base64 Decoding
|
||||
// -------------------------------------------------------------------------
|
||||
auto test_base64_decode() -> bool {
|
||||
// Case 1: Standard text
|
||||
|
||||
{
|
||||
const String encoded = "SGVsbG8gV29ybGQ=";
|
||||
const Vec<u8> decoded = StringOps::decode_base64(encoded);
|
||||
@ -78,7 +68,6 @@ auto test_base64_decode() -> bool {
|
||||
IAT_CHECK_EQ(result, String("Hello World"));
|
||||
}
|
||||
|
||||
// Case 2: Empty
|
||||
{
|
||||
const Vec<u8> decoded = StringOps::decode_base64("");
|
||||
IAT_CHECK(decoded.empty());
|
||||
@ -87,9 +76,6 @@ auto test_base64_decode() -> bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// 3. Round Trip (Binary Data)
|
||||
// -------------------------------------------------------------------------
|
||||
auto test_base64_round_trip() -> bool {
|
||||
Vec<u8> original;
|
||||
original.reserve(256);
|
||||
|
||||
Reference in New Issue
Block a user