34 lines
967 B
C
34 lines
967 B
C
#include "runner.h"
|
|
#include "../pretty_print.h"
|
|
#include "../arena.h"
|
|
#include <stdio.h>
|
|
|
|
UNIT_TEST(pretty_print_basic) {
|
|
arena_t arena = arena_make(ARENA_MALLOC, KB(4));
|
|
|
|
// The pretty_print function outputs to console, so we can't easily verify its exact output
|
|
// Instead, we'll just verify it doesn't crash
|
|
pretty_print(arena, "Hello, <red>World!</>");
|
|
|
|
// Test with formatting
|
|
pretty_print(arena, "Value: <blue>%d</>, String: <green>%s</>", 42, "test");
|
|
|
|
arena_cleanup(&arena);
|
|
}
|
|
|
|
// Helper function to test variadic function
|
|
void test_pretty_printv(arena_t arena, const char *fmt, ...) {
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
pretty_printv(arena, fmt, args);
|
|
va_end(args);
|
|
}
|
|
|
|
UNIT_TEST(pretty_printv) {
|
|
arena_t arena = arena_make(ARENA_MALLOC, KB(4));
|
|
|
|
// Test the helper function
|
|
test_pretty_printv(arena, "Test <yellow>%d</> <cyan>%s</>", 42, "variadic");
|
|
|
|
arena_cleanup(&arena);
|
|
}
|