cbase 1.50.0
C/C++ Static Template
Loading...
Searching...
No Matches
main.c
1/*
2 * test/main.c
3 * cbase test suite entry point.
4 */
5
6#include "test/test.h"
7
8#include "test_base.c"
9#include "test_log.c"
10#include "test_memory.c"
11#include "test_str_builder.c"
12
13int
14main(void)
15{
16 tr_begin("cbase test suite");
17
18 BEGIN_SUITE("Base")
19 {
20 RUN_TEST(macros_math);
21 RUN_TEST(macros_linked_list);
22 RUN_TEST(strings_operations);
23 }
25
26 BEGIN_SUITE("Logging")
27 {
28 RUN_TEST(logging_system);
29 }
31
32 BEGIN_SUITE("Memory")
33 {
34 RUN_TEST(mem_arena_allocation);
35 RUN_TEST(mem_arena_aligned_push);
36 RUN_TEST(mem_arena_temp);
37 RUN_TEST(mem_arena_allocator_interface);
38 }
40
41 BEGIN_SUITE("StringBuilder")
42 {
43 RUN_TEST(sb_empty_join);
44 RUN_TEST(sb_single_append);
45 RUN_TEST(sb_multiple_append);
48 RUN_TEST(sb_result_in_separate_alloc);
49 RUN_TEST(sb_reset_and_reuse);
50 }
52
53 return tr_end();
54}
static void sb_append_cstr(StringBuilder *sb, MemAllocator *alloc, const char *cstr)
Appends a null-terminated C string to the builder.
static void sb_append_fmt(StringBuilder *sb, MemAllocator *alloc, const char *fmt,...)
Appends a printf-style formatted string to the builder.
Single-header testing framework with pretty-printed output.
#define BEGIN_SUITE(name)
Open a named suite block. Must be paired with END_SUITE.
Definition test.h:330
static int tr_end(void)
Print the results summary. Return value is the process exit code.
Definition test.h:304
#define END_SUITE
Close a suite block opened with BEGIN_SUITE.
Definition test.h:335
#define RUN_TEST(name)
Execute a test case and print the result.
Definition test.h:346
static void tr_begin(const char *title)
Print the top-level banner. Call once at the start of main().
Definition test.h:294