tests: Better suite creation

While the previous method of in-lining a stack allocated array of
tests into the suite struct declaration was nice, we had to update
size manually.

This macro will allow us to just append new tests to the suite without
having to care for that.  It generates a uniquely named variable for
the test array, then uses that test array in the suite declaration.
Nice and easy.
This commit is contained in:
2026-02-05 06:44:35 +00:00
parent 61efa91403
commit 762dabd3e5
6 changed files with 22 additions and 55 deletions

View File

@@ -186,19 +186,11 @@ void sys_test(void)
TEST_PASSED();
}
const test_suite_t LISP_API_SUITE = {
.name = "Lisp API Tests",
.tests =
(test_fn[]){
MAKE_TEST_FN(smi_test),
MAKE_TEST_FN(smi_oob_test),
MAKE_TEST_FN(sym_fresh_test),
MAKE_TEST_FN(sym_unique_test),
MAKE_TEST_FN(cons_test),
MAKE_TEST_FN(sys_test),
},
.size = 6,
};
MAKE_TEST_SUITE(LISP_API_SUITE, "LISP API Tests",
MAKE_TEST_FN(smi_test), MAKE_TEST_FN(smi_oob_test),
MAKE_TEST_FN(sym_fresh_test), MAKE_TEST_FN(sym_unique_test),
MAKE_TEST_FN(cons_test), MAKE_TEST_FN(sys_test), );
/* Copyright (C) 2026 Aryadev Chavali