Skip to content

test: add 56 unit tests for semantic, slab_alloc, and ast_profile modules#681

Open
RollerCoaster1899 wants to merge 1 commit into
DeusData:mainfrom
RollerCoaster1899:test/add-unit-tests-semantic-slab-astprofile
Open

test: add 56 unit tests for semantic, slab_alloc, and ast_profile modules#681
RollerCoaster1899 wants to merge 1 commit into
DeusData:mainfrom
RollerCoaster1899:test/add-unit-tests-semantic-slab-astprofile

Conversation

@RollerCoaster1899

Copy link
Copy Markdown

Summary

Adds 56 unit tests across 3 new test files for previously untested modules:

  • tests/test_semantic.c (32 tests): cbm_sem_tokenize (camel/snake/dot/abbrev), cbm_sem_cosine (identical/orthogonal/zero/negative/null), cbm_sem_normalize, cbm_sem_vec_add_scaled, cbm_sem_random_index (determinism), cbm_sem_proximity, cbm_sem_diffuse, corpus lifecycle, IDF, config
  • tests/test_slab_alloc.c (14 tests): Slab malloc/free (≤64B and >64B), calloc zeroing/overflow, realloc (shrink/promote/same-size), free-list cycling, pointer uniqueness, thread reset
  • tests/test_ast_profile.c (10 tests): to_str/from_str round-trip (25 fields), null/empty/invalid inputs, to_vector range/saturation

Verification

./build/c/test-runner semantic ast_profile slab_alloc

All 56 pass with ASan+UBSan.

Files modified

  • Makefile.cbm: Register new test sources in ALL_TEST_SRCS
  • tests/test_main.c: Register suite_semantic, suite_ast_profile, suite_slab_alloc

…ules

Add focused unit tests for three previously untested modules:

- tests/test_semantic.c (32 tests): cbm_sem_tokenize (camel/snake/dot/abbrev),
  cbm_sem_cosine (identical/orthogonal/zero/negative/null),
  cbm_sem_normalize, cbm_sem_vec_add_scaled,
  cbm_sem_random_index (determinism), cbm_sem_proximity,
  cbm_sem_diffuse, corpus lifecycle, IDF, config

- tests/test_slab_alloc.c (14 tests): slab malloc/free (≤64B and >64B),
  calloc zeroing/overflow, realloc (shrink/promote/same-size),
  free-list cycling, pointer uniqueness, thread reset

- tests/test_ast_profile.c (10 tests): to_str/from_str round-trip
  (25 fields), null/empty/invalid inputs, to_vector range/saturation

All 56 tests pass with ASan+UBSan. Registered in Makefile.cbm
and test_main.c.

Signed-off-by: Raul Acosta <raulacosta@users.noreply.github.com>
Signed-off-by: Raul Acosta <raul.acosta.mmm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant