From 0e8cdd7507e72e1c0d4bcdf811bdced877f2c873 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 5 Feb 2026 05:34:39 +0000 Subject: [PATCH] test_lisp_api: sym_test -> sym_fresh_test --- test/test_lisp_api.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/test_lisp_api.c b/test/test_lisp_api.c index 478b16d..40d9d70 100644 --- a/test/test_lisp_api.c +++ b/test/test_lisp_api.c @@ -12,6 +12,8 @@ void smi_test(void) { + // Standard old testing, checking both sides of the number line and our set + // bounds. i64 ints[] = { 1, -1, (1 << 10) - 1, (-1) * ((1 << 10) - 1), INT_MIN, INT_MAX, }; @@ -51,11 +53,13 @@ void smi_oob_test(void) TEST_PASSED(); } -void sym_test(void) +void sym_fresh_test(void) { sys_t system = {0}; sys_init(&system); + // We expect every interned symbol to get a fresh allocation, but still be a + // valid representation of the original symbol. for (u64 i = 0; i < ARRSIZE(words); ++i) { const char *in = words[i]; @@ -84,7 +88,13 @@ void cons_test(void) lisp = cons(&system, lword, lisp); } - // Make sure we've essentially reversed the `words` array + /* + As we've cons'd each word, we'd expect the order to be reversed. This test + will allow us to verify: + 1) words have actually been added to the linked list. + 2) words are in the order we expect. + in one go. + */ u64 i = ARRSIZE(words); for (lisp_t *iter = lisp; iter; iter = cdr(iter), --i) { @@ -106,7 +116,7 @@ const test_suite_t LISP_API_SUITE = { (test_fn[]){ MAKE_TEST_FN(smi_test), MAKE_TEST_FN(smi_oob_test), - MAKE_TEST_FN(sym_test), + MAKE_TEST_FN(sym_fresh_test), MAKE_TEST_FN(cons_test), }, .size = 4,