Release Readt
Some checks failed
CI / build-linux-and-wasm (x64-linux) (push) Has been cancelled

This commit is contained in:
2026-01-25 22:08:16 +05:30
parent 601b573983
commit ebde7c7e66
19 changed files with 51 additions and 567 deletions

View File

@ -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);