.
This commit is contained in:
parent
524ec0d1ce
commit
61c1060a98
16 changed files with 5043 additions and 31 deletions
33
tests/pretty_print_tests.c
Normal file
33
tests/pretty_print_tests.c
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "runner.h"
|
||||
#include "../colla.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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue