Branch :
/* kc3
* Copyright from 2022 to 2025 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
#include "../libkc3/endian.h"
#include "../libkc3/fact.h"
#include "../libkc3/file.h"
#include "../libkc3/marshall.h"
#include "../libkc3/str.h"
#include "../libkc3/list.h"
#include "../libkc3/tag.h"
#include "test.h"
#define MARSHALL_TEST(type, test, expected) \
do { \
s_marshall m = {0}; \
const s_str expected_str = STR(expected); \
s_str test_str = {0}; \
test_context("marshall_" # type "(&m, " # test ") -> " \
# expected); \
TEST_ASSERT(marshall_init(&m)); \
TEST_ASSERT(marshall_ ## type (&m, false, (type) (test))); \
TEST_ASSERT(marshall_to_str(&m, &test_str)); \
TEST_STR_HEX_EQ(test_str, expected_str); \
marshall_clean(&m); \
str_clean(&test_str); \
test_context(NULL); \
} while (0)
#define MARSHALL_TEST_STR(test, expected) \
do { \
s_marshall m = {0}; \
const s_str str_expected = STR(expected); \
s_str str_test = {0}; \
s_str str_result = {0}; \
test_context("marshall_str(&m, " # test ") -> " # expected); \
TEST_EQ(marshall_init(&m), &m); \
TEST_EQ(str_init(&str_test, NULL, sizeof(test) - 1, (test)), \
&str_test); \
TEST_EQ(marshall_str(&m, false, &str_test), &m); \
TEST_EQ(marshall_to_str(&m, &str_result), &str_result); \
TEST_STR_HEX_EQ(str_result, str_expected); \
str_clean(&str_result); \
str_clean(&str_test); \
marshall_clean(&m); \
test_context(NULL); \
} while (0)
#define MARSHALL_TEST_TAG(test, expected) \
do { \
s_marshall m = {0}; \
const s_str expected_str = STR(expected); \
s_tag tag = {0}; \
s_str test_str = {0}; \
test_context("marshall_tag(" # test ") -> " # expected); \
TEST_ASSERT(tag_init_1(&tag, test)); \
TEST_EQ(marshall_init(&m), &m); \
TEST_EQ(marshall_tag(&m, false, &tag), &m); \
TEST_ASSERT(marshall_to_str(&m, &test_str)); \
TEST_STR_HEX_EQ(test_str, expected_str); \
marshall_clean(&m); \
tag_clean(&tag); \
str_clean(&test_str); \
test_context(NULL); \
} while (0)
void marshal_test (void);
TEST_CASE_PROTOTYPE(marshall_bool);
TEST_CASE_PROTOTYPE(marshall_character);
TEST_CASE_PROTOTYPE(marshall_s8);
TEST_CASE_PROTOTYPE(marshall_s16);
TEST_CASE_PROTOTYPE(marshall_s32);
TEST_CASE_PROTOTYPE(marshall_s64);
#if ! (defined(WIN32) || defined(WIN64))
TEST_CASE_PROTOTYPE(marshall_sw);
#endif
TEST_CASE_PROTOTYPE(marshall_to_buf);
TEST_CASE_PROTOTYPE(marshall_to_file);
TEST_CASE_PROTOTYPE(marshall_to_str);
TEST_CASE_PROTOTYPE(marshall_u8);
TEST_CASE_PROTOTYPE(marshall_u16);
TEST_CASE_PROTOTYPE(marshall_u32);
TEST_CASE_PROTOTYPE(marshall_u64);
TEST_CASE_PROTOTYPE(marshall_uw);
TEST_CASE_PROTOTYPE(marshall_plist);
TEST_CASE_PROTOTYPE(marshall_plist_twice);
TEST_CASE_PROTOTYPE(marshall_str);
TEST_CASE_PROTOTYPE(marshall_tag);
void marshall_test (void)
{
TEST_CASE_RUN(marshall_bool);
TEST_CASE_RUN(marshall_character);
TEST_CASE_RUN(marshall_s8);
TEST_CASE_RUN(marshall_s16);
TEST_CASE_RUN(marshall_s32);
TEST_CASE_RUN(marshall_s64);
#if ! (defined(WIN32) || defined(WIN64))
TEST_CASE_RUN(marshall_sw);
#endif
TEST_CASE_RUN(marshall_to_buf);
TEST_CASE_RUN(marshall_to_str);
TEST_CASE_RUN(marshall_to_file);
TEST_CASE_RUN(marshall_u8);
TEST_CASE_RUN(marshall_u16);
TEST_CASE_RUN(marshall_u32);
TEST_CASE_RUN(marshall_u64);
TEST_CASE_RUN(marshall_uw);
TEST_CASE_RUN(marshall_plist);
TEST_CASE_RUN(marshall_plist_twice);
TEST_CASE_RUN(marshall_str);
TEST_CASE_RUN(marshall_tag);
}
TEST_CASE(marshall_bool)
{
MARSHALL_TEST(bool, false,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0a\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x42\x4f\x4f\x4c"
"\x5f\x00");
MARSHALL_TEST(bool, true,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0a\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x42\x4f\x4f\x4c"
"\x5f\x01");
}
TEST_CASE_END(marshall_bool)
TEST_CASE(marshall_character)
{
MARSHALL_TEST(character, 'A',
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x01\x00\x00\x00\x00\x00\x00\x00"
"A");
MARSHALL_TEST(character, '\0',
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x01\x00\x00\x00\x00\x00\x00\x00"
"\x00");
MARSHALL_TEST(character, 'Z',
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x01\x00\x00\x00\x00\x00\x00\x00"
"Z");
}
TEST_CASE_END(marshall_character)
TEST_CASE(marshall_plist)
{
s_marshall m = {0};
s_list *list_test;
s_str str = {0};
const s_str expected = STR("KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x86\x00\x00\x00\x00\x00\x00\x00"
"\x12\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x4c\x49\x53\x54"
"\x5f\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x00\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x16\x5f\x4b\x43\x33\x50\x4c\x49"
"\x53\x54\x5f\x63\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x4c"
"\x49\x53\x54\x5f\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x11\x5f\x4b\x43\x33"
"\x55\x38\x5f\x01\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x16\x5f\x4b\x43\x33"
"\x50\x4c\x49\x53\x54\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x50\x4c\x49\x53\x54\x5f"
"\x20\x00\x00\x00\x00\x00\x00\x00");
TEST_ASSERT(marshall_init(&m));
list_test = list_new_1("[0, 1]");
TEST_ASSERT(list_test);
TEST_ASSERT(marshall_plist(&m, false, &list_test));
marshall_to_str(&m, &str);
TEST_STR_HEX_EQ(str, expected);
str_clean(&str);
list_delete_all(list_test);
marshall_clean(&m);
}
TEST_CASE_END(marshall_plist)
TEST_CASE(marshall_plist_twice)
{
s_marshall m = {0};
s_list *list_test;
s_str str = {0};
const s_str expected = STR("KC3MARSH"
"\x04\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x01\x00\x00\x00\x00\x00\x00"
"\x24\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x4c\x49\x53\x54"
"\x5f\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x00\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x16\x5f\x4b\x43\x33\x50\x4c\x49"
"\x53\x54\x5f\x63\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x4c"
"\x49\x53\x54\x5f\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x11\x5f\x4b\x43\x33"
"\x55\x38\x5f\x01\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x16\x5f\x4b\x43\x33"
"\x50\x4c\x49\x53\x54\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x4c\x49\x53\x54\x5f\x5f"
"\x4b\x43\x33\x54\x41\x47\x5f\x5f"
"\x4b\x43\x33\x55\x38\x5f\x11\x5f"
"\x4b\x43\x33\x55\x38\x5f\x00\x5f"
"\x4b\x43\x33\x54\x41\x47\x5f\x5f"
"\x4b\x43\x33\x55\x38\x5f\x16\x5f"
"\x4b\x43\x33\x50\x4c\x49\x53\x54"
"\x5f\xe9\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x4c\x49\x53"
"\x54\x5f\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x11\x5f\x4b\x43\x33\x55\x38"
"\x5f\x01\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x16\x5f\x4b\x43\x33\x50\x4c"
"\x49\x53\x54\x5f\x00\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x50\x4c\x49\x53\x54\x5f\x20\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x50\x4c\x49\x53\x54\x5f"
"\xa6\x00\x00\x00\x00\x00\x00\x00");
TEST_ASSERT(marshall_init(&m));
list_test = list_new_1("[0, 1]");
TEST_ASSERT(list_test);
TEST_ASSERT(marshall_plist(&m, false, &list_test));
TEST_ASSERT(marshall_plist(&m, false, &list_test));
marshall_to_str(&m, &str);
TEST_STR_HEX_EQ(str, expected);
str_clean(&str);
list_delete_all(list_test);
marshall_clean(&m);
}
TEST_CASE_END(marshall_plist_twice)
TEST_CASE(marshall_fact)
{
s_marshall m = {0};
s_fact fact = {0};
s_str str = {0};
const s_str expected = STR("");
TEST_ASSERT(marshall_init(&m));
fact_init_1(&fact, "{1, 2, 3}");
TEST_ASSERT(marshall_fact(&m, false, &fact));
marshall_to_str(&m, &str);
TEST_STR_HEX_EQ(str, expected);
str_clean(&str);
marshall_clean(&m);
}
TEST_CASE_END(marshall_plist)
TEST_CASE(marshall_s8)
{
MARSHALL_TEST(s8, 0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x08\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x38\x5f\x00");
MARSHALL_TEST(s8, 0xAB,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x08\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x38\x5f\xAB");
}
TEST_CASE_END(marshall_s8)
TEST_CASE(marshall_s16)
{
MARSHALL_TEST(s16, 0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0a\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x31\x36\x5f"
"\x00\x00");
MARSHALL_TEST(s16, -1,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0a\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x31\x36\x5f"
"\xFF\xFF");
}
TEST_CASE_END(marshall_s16)
TEST_CASE(marshall_s32)
{
MARSHALL_TEST(s32, 0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x33\x32\x5f"
"\x00\x00\x00\x00");
MARSHALL_TEST(s32, ~0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x33\x32\x5f"
"\xFF\xFF\xFF\xFF");
MARSHALL_TEST(s32, 0xDEADBEEF,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x33\x32\x5f"
"\xEF\xBE\xAD\xDE");
MARSHALL_TEST(s32, 0xDEADCAFE,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x33\x32\x5f"
"\xFE\xCA\xAD\xDE");
MARSHALL_TEST(s32, 0xFEEDBABE,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x33\x32\x5f"
"\xBE\xBA\xED\xFE");
}
TEST_CASE_END(marshall_s32)
TEST_CASE(marshall_s64)
{
MARSHALL_TEST(s64, 0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x10\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x36\x34\x5f"
"\x00\x00\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST(s64, ~0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x10\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x36\x34\x5f"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF");
}
TEST_CASE_END(marshall_s64)
TEST_CASE(marshall_str)
{
MARSHALL_TEST_STR("",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x14\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x54\x52\x5f"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\x00\x00\x00\x00");
MARSHALL_TEST_STR("hello",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x19\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x54\x52\x5f"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\x05\x00\x00\x00hell"
"o");
MARSHALL_TEST_STR("hello\xFF\x00world",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x20\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x54\x52\x5f"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\x0C\x00\x00\x00hell"
"o\xFF\x00world");
MARSHALL_TEST_STR("héllo wörld",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x21\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x54\x52\x5f"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\r\x00\x00\x00héllo wörld");
}
TEST_CASE_END(marshall_str)
// TODO: broken on windows
#if ! (defined(WIN32) || defined(WIN64))
TEST_CASE(marshall_sw)
{
MARSHALL_TEST(sw, 0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x17\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x57\x5f\x5f"
"\x4b\x43\x33\x53\x36\x34\x5f\x00"
"\x00\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST(sw, ~0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x17\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x57\x5f\x5f"
"\x4b\x43\x33\x53\x36\x34\x5f\xFF"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF");
}
TEST_CASE_END(marshall_sw)
#endif
TEST_CASE(marshall_tag)
{
// U8
MARSHALL_TEST_TAG("0",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x18\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x00");
MARSHALL_TEST_TAG("1",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x18\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x01");
MARSHALL_TEST_TAG("2",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x18\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x02");
// U16
MARSHALL_TEST_TAG("256",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x1a\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x12"
"\x5f\x4b\x43\x33\x55\x31\x36\x5f"
"\x00\x01");
// U32
MARSHALL_TEST_TAG("65536",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x1c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x13"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\x00\x00\x01\x00");
// U64
MARSHALL_TEST_TAG("92233720368547",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x20\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x14"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\xA3\x8D#\xD6\xE2S\x00\x00");
// S8
MARSHALL_TEST_TAG("-1",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x18\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x10"
"\x5f\x4b\x43\x33\x53\x38\x5f\xff");
// S16
MARSHALL_TEST_TAG("-129",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x1a\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x0f"
"\x5f\x4b\x43\x33\x53\x31\x36\x5f"
"\x7f\xff");
// S32
MARSHALL_TEST_TAG("-2147483648",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x1c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x0e"
"\x5f\x4b\x43\x33\x53\x33\x32\x5f"
"\x00\x00\x00\x80");
// S64
MARSHALL_TEST_TAG("-52233720368547",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x20\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x0d"
"\x5f\x4b\x43\x33\x53\x36\x34\x5f"
"\x5d\xf2\xa6\x63\x7e\xd0\xff\xff");
// Integer
MARSHALL_TEST_TAG("(Integer) 1024",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x25\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x0a"
"\x5f\x4b\x43\x33\x49\x4e\x54\x45"
"\x47\x45\x52\x5f\x00\x01\x00\x00"
"\x00\x00\x04\x00\x00");
MARSHALL_TEST_TAG("10000000000000000000000000000000000",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x35\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x0a"
"\x5f\x4b\x43\x33\x49\x4e\x54\x45"
"\x47\x45\x52\x5f\x00\x05\x00\x00"
"\x00\x00\x00\x00\x00\x40\xe6\xd8"
"\x08\x37\xc0\x87\x0d\xea\x9b\xd0"
"\x0e\x01\x00\x00\x00");
MARSHALL_TEST_TAG("123456789012345678901234567890",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x31\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x0a"
"\x5f\x4b\x43\x33\x49\x4e\x54\x45"
"\x47\x45\x52\x5f\x00\x04\x00\x00"
"\x00\xd2\x0a\x3f\x0e\xe4\x0e\x3e"
"\x07\xc3\xf6\x0f\x09\xee\x18\x00"
"\x00");
// List
MARSHALL_TEST_TAG("[1, 2]",
"KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x86\x00\x00\x00\x00\x00\x00\x00"
"\x22\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x4c\x49\x53\x54"
"\x5f\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x01\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x16\x5f\x4b\x43\x33\x50\x4c\x49"
"\x53\x54\x5f\x63\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x4c"
"\x49\x53\x54\x5f\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x11\x5f\x4b\x43\x33"
"\x55\x38\x5f\x02\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x16\x5f\x4b\x43\x33"
"\x50\x4c\x49\x53\x54\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x16\x5f\x4b"
"\x43\x33\x50\x4c\x49\x53\x54\x5f"
"\x20\x00\x00\x00\x00\x00\x00\x00");
// Float
MARSHALL_TEST_TAG("(F32) 3.1415927",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x1c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x05"
"\x5f\x4b\x43\x33\x46\x33\x32\x5f"
"\xdb\x0f\x49\x40");
MARSHALL_TEST_TAG("(F64) 3.141592653589793",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x20\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x06"
"\x5f\x4b\x43\x33\x46\x36\x34\x5f"
"\x18\x2d\x44\x54\xfb\x21\x09\x40");
#if HAVE_F80
MARSHALL_TEST_TAG("(F80) 3.1415926535897932384",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x28\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x07"
"\x5f\x4b\x43\x33\x46\x38\x30\x5f"
"\x32\xc2\x68\x21\xa2\xda\x0f\xc9"
"\x00\x40\x00\x00\x00\x00\x00\x00");
#endif
// Do block
MARSHALL_TEST_TAG("do\n"
" 1\n"
" 2\n"
" 3\n"
"end",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x79\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x02"
"\x5f\x4b\x43\x33\x55\x57\x5f\x5f"
"\x4b\x43\x33\x55\x36\x34\x5f\x03"
"\x00\x00\x00\x00\x00\x00\x00\x5f"
"\x4b\x43\x33\x42\x4f\x4f\x4c\x5f"
"\x00\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x01\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x02\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x03");
// Tuple
MARSHALL_TEST_TAG("{1, 2, [3, 4]}",
"KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x86\x00\x00\x00\x00\x00\x00\x00"
"\x79\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x4c\x49\x53\x54"
"\x5f\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x03\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x16\x5f\x4b\x43\x33\x50\x4c\x49"
"\x53\x54\x5f\x63\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x4c"
"\x49\x53\x54\x5f\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x11\x5f\x4b\x43\x33"
"\x55\x38\x5f\x04\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x16\x5f\x4b\x43\x33"
"\x50\x4c\x49\x53\x54\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x28\x5f\x4b"
"\x43\x33\x55\x57\x5f\x5f\x4b\x43"
"\x33\x55\x36\x34\x5f\x03\x00\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x54\x41\x47\x5f\x5f\x4b\x43"
"\x33\x55\x38\x5f\x11\x5f\x4b\x43"
"\x33\x55\x38\x5f\x01\x5f\x4b\x43"
"\x33\x54\x41\x47\x5f\x5f\x4b\x43"
"\x33\x55\x38\x5f\x11\x5f\x4b\x43"
"\x33\x55\x38\x5f\x02\x5f\x4b\x43"
"\x33\x54\x41\x47\x5f\x5f\x4b\x43"
"\x33\x55\x38\x5f\x16\x5f\x4b\x43"
"\x33\x50\x4c\x49\x53\x54\x5f\x20"
"\x00\x00\x00\x00\x00\x00\x00");
// Psym
MARSHALL_TEST_TAG("Module",
"KC3MARSH"
"\x01\x00\x00\x00\x00\x00\x00\x00"
"\x22\x00\x00\x00\x00\x00\x00\x00"
"\x21\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x59\x4d\x5f"
"\x5f\x4b\x43\x33\x53\x54\x52\x5f"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\x06\x00\x00\x00\x4d\x6f\x64\x75"
"\x6c\x65\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x20\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x20\x00\x00\x00\x00"
"\x00\x00\x00");
// Map
MARSHALL_TEST_TAG("%{a: 1, b: 2}",
"KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x3a\x00\x00\x00\x00\x00\x00\x00"
"\xa1\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x53\x59\x4d\x5f"
"\x5f\x4b\x43\x33\x53\x54\x52\x5f"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\x01\x00\x00\x00\x61\x5f\x4b\x43"
"\x33\x53\x59\x4d\x5f\x5f\x4b\x43"
"\x33\x53\x54\x52\x5f\x5f\x4b\x43"
"\x33\x55\x33\x32\x5f\x01\x00\x00"
"\x00\x62\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x17\x5f\x4b\x43\x33\x4d\x41"
"\x50\x5f\x5f\x4b\x43\x33\x55\x57"
"\x5f\x5f\x4b\x43\x33\x55\x36\x34"
"\x5f\x02\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x20\x5f\x4b\x43\x33\x50\x53\x59"
"\x4d\x5f\x20\x00\x00\x00\x00\x00"
"\x00\x00\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x11\x5f\x4b\x43\x33\x55\x38"
"\x5f\x01\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x20\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x3d\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x54"
"\x41\x47\x5f\x5f\x4b\x43\x33\x55"
"\x38\x5f\x11\x5f\x4b\x43\x33\x55"
"\x38\x5f\x02");
// Cfn
MARSHALL_TEST_TAG("cfn Tag \"tag_add\" (Tag, Tag, Result)",
"KC3MARSH"
"\x06\x00\x00\x00\x00\x00\x00\x00"
"\x47\x01\x00\x00\x00\x00\x00\x00"
"\x26\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x38\x5f\x01"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x00\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x42\x4f\x4f\x4c\x5f\x00\x5f\x4b"
"\x43\x33\x42\x4f\x4f\x4c\x5f\x00"
"\x5f\x4b\x43\x33\x50\x53\x59\x4d"
"\x5f\x79\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x53\x59\x4d"
"\x5f\x5f\x4b\x43\x33\x53\x54\x52"
"\x5f\x5f\x4b\x43\x33\x55\x33\x32"
"\x5f\x03\x00\x00\x00\x54\x61\x67"
"\x5f\x4b\x43\x33\x50\x53\x59\x4d"
"\x5f\xa9\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x53\x59\x4d"
"\x5f\x5f\x4b\x43\x33\x53\x54\x52"
"\x5f\x5f\x4b\x43\x33\x55\x33\x32"
"\x5f\x07\x00\x00\x00\x74\x61\x67"
"\x5f\x61\x64\x64\x5f\x4b\x43\x33"
"\x55\x38\x5f\x03\x5f\x4b\x43\x33"
"\x50\x53\x59\x4d\x5f\xe5\x00\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x53\x59\x4d\x5f\x5f\x4b\x43"
"\x33\x53\x54\x52\x5f\x5f\x4b\x43"
"\x33\x55\x33\x32\x5f\x03\x00\x00"
"\x00\x54\x61\x67\x5f\x4b\x43\x33"
"\x50\x53\x59\x4d\x5f\x15\x01\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x53\x59\x4d\x5f\x5f\x4b\x43"
"\x33\x53\x54\x52\x5f\x5f\x4b\x43"
"\x33\x55\x33\x32\x5f\x03\x00\x00"
"\x00\x54\x61\x67\x5f\x4b\x43\x33"
"\x50\x53\x59\x4d\x5f\x45\x01\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x53\x59\x4d\x5f\x5f\x4b\x43"
"\x33\x53\x54\x52\x5f\x5f\x4b\x43"
"\x33\x55\x33\x32\x5f\x06\x00\x00"
"\x00\x52\x65\x73\x75\x6c\x74\x5f"
"\x4b\x43\x33\x54\x41\x47\x5f\x5f"
"\x4b\x43\x33\x55\x38\x5f\x19\x5f"
"\x4b\x43\x33\x50\x43\x41\x4c\x4c"
"\x41\x42\x4c\x45\x5f\x20\x00\x00"
"\x00\x00\x00\x00\x00");
// Call
MARSHALL_TEST_TAG("defmodule Test do end",
"KC3MARSH"
"\x03\x00\x00\x00\x00\x00\x00\x00"
"\xf0\x00\x00\x00\x00\x00\x00\x00"
"\x22\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x4c\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x09\x00\x00\x00"
"\x64\x65\x66\x6d\x6f\x64\x75\x6c"
"\x65\x5f\x4b\x43\x33\x55\x57\x5f"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x20"
"\x5f\x4b\x43\x33\x50\x53\x59\x4d"
"\x5f\xa9\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x53\x59\x4d"
"\x5f\x5f\x4b\x43\x33\x53\x54\x52"
"\x5f\x5f\x4b\x43\x33\x55\x33\x32"
"\x5f\x04\x00\x00\x00\x54\x65\x73"
"\x74\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x02\x5f\x4b\x43\x33\x55\x57\x5f"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x42\x4f\x4f\x4c"
"\x5f\x00\x5f\x4b\x43\x33\x50\x43"
"\x41\x4c\x4c\x41\x42\x4c\x45\x5f"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x18"
"\x5f\x4b\x43\x33\x50\x43\x41\x4c"
"\x4c\x5f\x20\x00\x00\x00\x00\x00"
"\x00\x00");
MARSHALL_TEST_TAG("List.reverse([])",
"KC3MARSH"
"\x03\x00\x00\x00\x00\x00\x00\x00"
"\xbe\x00\x00\x00\x00\x00\x00\x00"
"\x22\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x3b\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x53"
"\x59\x4d\x5f\x5f\x4b\x43\x33\x53"
"\x54\x52\x5f\x5f\x4b\x43\x33\x55"
"\x33\x32\x5f\x04\x00\x00\x00\x4c"
"\x69\x73\x74\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x6c\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x07\x00\x00\x00"
"\x72\x65\x76\x65\x72\x73\x65\x5f"
"\x4b\x43\x33\x55\x57\x5f\x5f\x4b"
"\x43\x33\x55\x36\x34\x5f\x01\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x16\x5f\x4b"
"\x43\x33\x50\x4c\x49\x53\x54\x5f"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x50\x43\x41\x4c"
"\x4c\x41\x42\x4c\x45\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x18\x5f\x4b"
"\x43\x33\x50\x43\x41\x4c\x4c\x5f"
"\x20\x00\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST_TAG("a = 1",
"KC3MARSH"
"\x03\x00\x00\x00\x00\x00\x00\x00"
"\xe7\x00\x00\x00\x00\x00\x00\x00"
"\x22\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x4c\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x01\x00\x00\x00"
"\x3d\x5f\x4b\x43\x33\x55\x57\x5f"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x2a"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\xbc\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x01\x00\x00\x00"
"\x61\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x01\x5f\x4b\x43\x33\x50\x43\x41"
"\x4c\x4c\x41\x42\x4c\x45\x5f\x00"
"\x00\x00\x00\x00\x00\x00\x00\x5f"
"\x4b\x43\x33\x54\x41\x47\x5f\x5f"
"\x4b\x43\x33\x55\x38\x5f\x18\x5f"
"\x4b\x43\x33\x50\x43\x41\x4c\x4c"
"\x5f\x20\x00\x00\x00\x00\x00\x00"
"\x00");
MARSHALL_TEST_TAG("fn (x) { x * 2 }",
"KC3MARSH"
"\x06\x00\x00\x00\x00\x00\x00\x00"
"\x4a\x02\x00\x00\x00\x00\x00\x00"
"\x26\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x38\x5f\x02"
"\x5f\x4b\x43\x33\x46\x4e\x5f\x5f"
"\x4b\x43\x33\x42\x4f\x4f\x4c\x5f"
"\x00\x5f\x4b\x43\x33\x42\x4f\x4f"
"\x4c\x5f\x00\x5f\x4b\x43\x33\x49"
"\x44\x45\x4e\x54\x5f\x5f\x4b\x43"
"\x33\x50\x53\x59\x4d\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x50\x53\x59\x4d\x5f\x00"
"\x00\x00\x00\x00\x00\x00\x00\x5f"
"\x4b\x43\x33\x50\x53\x59\x4d\x5f"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x57\x5f\x5f"
"\x4b\x43\x33\x55\x36\x34\x5f\x01"
"\x00\x00\x00\x00\x00\x00\x00\x5f"
"\x4b\x43\x33\x50\x4c\x49\x53\x54"
"\x5f\xa9\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x4c\x49\x53"
"\x54\x5f\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x2a\x5f\x4b\x43\x33\x49\x44"
"\x45\x4e\x54\x5f\x5f\x4b\x43\x33"
"\x50\x53\x59\x4d\x5f\x00\x00\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x50\x53\x59\x4d\x5f\xee\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x53\x59\x4d\x5f\x5f\x4b"
"\x43\x33\x53\x54\x52\x5f\x5f\x4b"
"\x43\x33\x55\x33\x32\x5f\x01\x00"
"\x00\x00\x78\x5f\x4b\x43\x33\x54"
"\x41\x47\x5f\x5f\x4b\x43\x33\x55"
"\x38\x5f\x16\x5f\x4b\x43\x33\x50"
"\x4c\x49\x53\x54\x5f\x00\x00\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x55\x57\x5f\x5f\x4b\x43\x33"
"\x55\x36\x34\x5f\x01\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x42\x4f\x4f\x4c\x5f\x01\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x18\x5f\x4b"
"\x43\x33\x50\x43\x41\x4c\x4c\x5f"
"\x70\x01\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x9c\x01\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x01\x00\x00\x00"
"\x2a\x5f\x4b\x43\x33\x55\x57\x5f"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x2a"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x0c\x02\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x01\x00\x00\x00"
"\x78\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x02\x5f\x4b\x43\x33\x50\x43\x41"
"\x4c\x4c\x41\x42\x4c\x45\x5f\x00"
"\x00\x00\x00\x00\x00\x00\x00\x5f"
"\x4b\x43\x33\x50\x46\x52\x41\x4d"
"\x45\x5f\x00\x00\x00\x00\x00\x00"
"\x00\x00\x5f\x4b\x43\x33\x54\x41"
"\x47\x5f\x5f\x4b\x43\x33\x55\x38"
"\x5f\x19\x5f\x4b\x43\x33\x50\x43"
"\x41\x4c\x4c\x41\x42\x4c\x45\x5f"
"\x20\x00\x00\x00\x00\x00\x00\x00");
// Ratio
MARSHALL_TEST_TAG("2/6",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x44\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x0b"
"\x5f\x4b\x43\x33\x52\x41\x54\x49"
"\x4f\x5f\x5f\x4b\x43\x33\x49\x4e"
"\x54\x45\x47\x45\x52\x5f\x00\x01"
"\x00\x00\x00\x02\x00\x00\x00\x5f"
"\x4b\x43\x33\x49\x4e\x54\x45\x47"
"\x45\x52\x5f\x00\x01\x00\x00\x00"
"\x06\x00\x00\x00");
// Quote
MARSHALL_TEST_TAG("quote 1 + 1",
"KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\xa6\x00\x00\x00\x00\x00\x00\x00"
"\x3c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x4c\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x01\x00\x00\x00"
"\x2b\x5f\x4b\x43\x33\x55\x57\x5f"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x01"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x01"
"\x5f\x4b\x43\x33\x50\x43\x41\x4c"
"\x4c\x41\x42\x4c\x45\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x25\x5f\x4b"
"\x43\x33\x51\x55\x4f\x54\x45\x5f"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x18"
"\x5f\x4b\x43\x33\x50\x43\x41\x4c"
"\x4c\x5f\x20\x00\x00\x00\x00\x00"
"\x00\x00");
// Var
MARSHALL_TEST_TAG("(U8) ?",
"KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x6d\x00\x00\x00\x00\x00\x00\x00"
"\x21\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x56\x41\x52\x5f"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x00\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x50\x53\x59\x4d\x5f\x65\x00\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x53\x59\x4d\x5f\x5f\x4b\x43"
"\x33\x53\x54\x52\x5f\x5f\x4b\x43"
"\x33\x55\x33\x32\x5f\x02\x00\x00"
"\x00\x55\x38\x5f\x4b\x43\x33\x42"
"\x4f\x4f\x4c\x5f\x00\x5f\x4b\x43"
"\x33\x54\x41\x47\x5f\x5f\x4b\x43"
"\x33\x55\x38\x5f\x24\x5f\x4b\x43"
"\x33\x50\x56\x41\x52\x5f\x20\x00"
"\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST_TAG("(Tag) ?",
"KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x6e\x00\x00\x00\x00\x00\x00\x00"
"\x21\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x56\x41\x52\x5f"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x00\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x50\x53\x59\x4d\x5f\x65\x00\x00"
"\x00\x00\x00\x00\x00\x5f\x4b\x43"
"\x33\x53\x59\x4d\x5f\x5f\x4b\x43"
"\x33\x53\x54\x52\x5f\x5f\x4b\x43"
"\x33\x55\x33\x32\x5f\x03\x00\x00"
"\x00\x54\x61\x67\x5f\x4b\x43\x33"
"\x42\x4f\x4f\x4c\x5f\x00\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x24\x5f\x4b"
"\x43\x33\x50\x56\x41\x52\x5f\x20"
"\x00\x00\x00\x00\x00\x00\x00");
// Complex
MARSHALL_TEST_TAG("1 +i 2",
"KC3MARSH"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\xa7\x00\x00\x00\x00\x00\x00\x00"
"\x22\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x4c\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x02\x00\x00\x00"
"\x2b\x69\x5f\x4b\x43\x33\x55\x57"
"\x5f\x5f\x4b\x43\x33\x55\x36\x34"
"\x5f\x02\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x01\x5f\x4b\x43\x33\x54\x41\x47"
"\x5f\x5f\x4b\x43\x33\x55\x38\x5f"
"\x11\x5f\x4b\x43\x33\x55\x38\x5f"
"\x02\x5f\x4b\x43\x33\x50\x43\x41"
"\x4c\x4c\x41\x42\x4c\x45\x5f\x00"
"\x00\x00\x00\x00\x00\x00\x00\x5f"
"\x4b\x43\x33\x54\x41\x47\x5f\x5f"
"\x4b\x43\x33\x55\x38\x5f\x18\x5f"
"\x4b\x43\x33\x50\x43\x41\x4c\x4c"
"\x5f\x20\x00\x00\x00\x00\x00\x00"
"\x00");
// Unquote
MARSHALL_TEST_TAG("unquote 123",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x28\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x29"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x7b");
// Time
MARSHALL_TEST_TAG("%Time{}",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x48\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x27"
"\x5f\x4b\x43\x33\x42\x4f\x4f\x4c"
"\x5f\x00\x5f\x4b\x43\x33\x53\x57"
"\x5f\x5f\x4b\x43\x33\x53\x36\x34"
"\x5f\x00\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x53\x57\x5f"
"\x5f\x4b\x43\x33\x53\x36\x34\x5f"
"\x00\x00\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST_TAG("%Time{tv_sec: 1000, tv_nsec: 2000}",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x48\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x27"
"\x5f\x4b\x43\x33\x42\x4f\x4f\x4c"
"\x5f\x00\x5f\x4b\x43\x33\x53\x57"
"\x5f\x5f\x4b\x43\x33\x53\x36\x34"
"\x5f\xe8\x03\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x53\x57\x5f"
"\x5f\x4b\x43\x33\x53\x36\x34\x5f"
"\xd0\x07\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST_TAG("%Time{tv_sec: 1 + 1, tv_nsec: 2 + 2}",
"KC3MARSH"
"\x04\x00\x00\x00\x00\x00\x00\x00"
"\x4c\x01\x00\x00\x00\x00\x00\x00"
"\x5e\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x49\x44\x45\x4e"
"\x54\x5f\x5f\x4b\x43\x33\x50\x53"
"\x59\x4d\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00\x5f\x4b\x43\x33\x50"
"\x53\x59\x4d\x5f\x4c\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x53\x59\x4d\x5f\x5f\x4b\x43\x33"
"\x53\x54\x52\x5f\x5f\x4b\x43\x33"
"\x55\x33\x32\x5f\x01\x00\x00\x00"
"\x2b\x5f\x4b\x43\x33\x55\x57\x5f"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\x02\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x01"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x11"
"\x5f\x4b\x43\x33\x55\x38\x5f\x01"
"\x5f\x4b\x43\x33\x50\x43\x41\x4c"
"\x4c\x41\x42\x4c\x45\x5f\x00\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x49\x44\x45\x4e\x54\x5f"
"\x5f\x4b\x43\x33\x50\x53\x59\x4d"
"\x5f\x00\x00\x00\x00\x00\x00\x00"
"\x00\x5f\x4b\x43\x33\x50\x53\x59"
"\x4d\x5f\xf2\x00\x00\x00\x00\x00"
"\x00\x00\x5f\x4b\x43\x33\x53\x59"
"\x4d\x5f\x5f\x4b\x43\x33\x53\x54"
"\x52\x5f\x5f\x4b\x43\x33\x55\x33"
"\x32\x5f\x01\x00\x00\x00\x2b\x5f"
"\x4b\x43\x33\x55\x57\x5f\x5f\x4b"
"\x43\x33\x55\x36\x34\x5f\x02\x00"
"\x00\x00\x00\x00\x00\x00\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x11\x5f\x4b"
"\x43\x33\x55\x38\x5f\x02\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x11\x5f\x4b"
"\x43\x33\x55\x38\x5f\x02\x5f\x4b"
"\x43\x33\x50\x43\x41\x4c\x4c\x41"
"\x42\x4c\x45\x5f\x00\x00\x00\x00"
"\x00\x00\x00\x00\x5f\x4b\x43\x33"
"\x54\x41\x47\x5f\x5f\x4b\x43\x33"
"\x55\x38\x5f\x27\x5f\x4b\x43\x33"
"\x42\x4f\x4f\x4c\x5f\x01\x5f\x4b"
"\x43\x33\x54\x41\x47\x5f\x5f\x4b"
"\x43\x33\x55\x38\x5f\x18\x5f\x4b"
"\x43\x33\x50\x43\x41\x4c\x4c\x5f"
"\x20\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x18"
"\x5f\x4b\x43\x33\x50\x43\x41\x4c"
"\x4c\x5f\xc6\x00\x00\x00\x00\x00"
"\x00\x00");
// Ptr
MARSHALL_TEST_TAG("(Ptr) 0",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x2f\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x22"
"\x5f\x4b\x43\x33\x50\x54\x52\x5f"
"\x5f\x4b\x43\x33\x55\x57\x5f\x5f"
"\x4b\x43\x33\x55\x36\x34\x5f\x00"
"\x00\x00\x00\x00\x00\x00\x00");
// PtrFree
MARSHALL_TEST_TAG("(PtrFree) 0",
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x33\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x54\x41\x47\x5f"
"\x5f\x4b\x43\x33\x55\x38\x5f\x23"
"\x5f\x4b\x43\x33\x50\x54\x52\x46"
"\x52\x45\x45\x5f\x5f\x4b\x43\x33"
"\x55\x57\x5f\x5f\x4b\x43\x33\x55"
"\x36\x34\x5f\x00\x00\x00\x00\x00"
"\x00\x00\x00");
}
TEST_CASE_END(marshall_tag)
TEST_CASE(marshall_to_buf)
{
char b[1024024] = {0};
s_buf buf = {0};
s_marshall m = {0};
buf_init(&buf, false, sizeof(b), b);
TEST_ASSERT(marshall_init(&m));
TEST_EQ(marshall_to_buf(&m, &buf), sizeof(s_marshall_header));
marshall_clean(&m);
}
TEST_CASE_END(marshall_to_buf)
TEST_CASE(marshall_to_file)
{
u32 value = 42;
s_marshall m = {0};
const s_str path = STR(".marshall_test_to_file.1.dump");
test_context("marshall_to_file(\".marshall_test_to_file.1.dump\")");
TEST_ASSERT(marshall_init(&m));
TEST_ASSERT(marshall_u32(&m, false, value));
TEST_EQ(marshall_to_file(&m, &path),
sizeof(s_marshall_header) + 8 + sizeof(u32));
TEST_EQ(test_file_compare(".marshall_test_to_file.1.dump",
"marshall_test_to_file.1.dump.expected"),
0);
marshall_clean(&m);
file_unlink(&path);
test_context(NULL);
}
TEST_CASE_END(marshall_to_file)
TEST_CASE(marshall_to_str)
{
u32 value = 424242;
s_marshall m = {0};
s_str str = {0};
s_str expected = {0};
TEST_ASSERT(marshall_init(&m));
TEST_ASSERT(marshall_u32(&m, false, value));
TEST_EQ(marshall_to_str(&m, &str), &str);
marshall_clean(&m);
expected = STR_CONST("KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\x32\x79\x06\x00");
TEST_STR_HEX_EQ(str, expected);
str_clean(&str);
}
TEST_CASE_END(marshall_to_str)
TEST_CASE(marshall_u8)
{
MARSHALL_TEST(u8, 0x00,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x08\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x38\x5f\x00");
MARSHALL_TEST(u8, 0xFF,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x08\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x38\x5f\xFF");
}
TEST_CASE_END(marshall_u8)
TEST_CASE(marshall_u16)
{
MARSHALL_TEST(u16, 0xFFFF,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0a\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x31\x36\x5f"
"\xFF\xFF");
}
TEST_CASE_END(marshall_u16)
TEST_CASE(marshall_u32)
{
MARSHALL_TEST(u32, 0xFFFFFFFF,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x0c\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x33\x32\x5f"
"\xFF\xFF\xFF\xFF");
}
TEST_CASE_END(marshall_u32)
TEST_CASE(marshall_u64)
{
MARSHALL_TEST(u64, 0xFFFFFFFFFFFFFFFF,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x10\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x36\x34\x5f"
"\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF");
}
TEST_CASE_END(marshall_u64)
TEST_CASE(marshall_uw)
{
MARSHALL_TEST(uw, 0,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x17\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x57\x5f\x5f"
"\x4b\x43\x33\x55\x36\x34\x5f\x00"
"\x00\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST(uw, 1,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x17\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x57\x5f\x5f"
"\x4b\x43\x33\x55\x36\x34\x5f\x01"
"\x00\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST(uw, 2,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x17\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x57\x5f\x5f"
"\x4b\x43\x33\x55\x36\x34\x5f\x02"
"\x00\x00\x00\x00\x00\x00\x00");
MARSHALL_TEST(uw, 1024,
"KC3MARSH"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00"
"\x17\x00\x00\x00\x00\x00\x00\x00"
"\x5f\x4b\x43\x33\x55\x57\x5f\x5f"
"\x4b\x43\x33\x55\x36\x34\x5f\x00"
"\x04\x00\x00\x00\x00\x00\x00");
}
TEST_CASE_END(marshall_uw)