Leonardo Francisco
|
c120ef0797
|
validity: add 16 regression tests for Iter6 audit fixes
Adds test-validity-verify.c with 16 unit tests that prevent regression
of all 8 issues found during the Iteration 6 code audit (b05657f):
R1: parse_match_result TLV parsing (5 tests)
- valid payload with all fields extracted correctly
- multi-tag iteration (tag ordering independence)
- empty dict returns no-match
- truncated/malformed data handled gracefully
- unknown tags skipped without error
R1f: match_result_clear frees hash and zeros struct
R2: identity builder NULL rejection (2 tests)
- NULL uuid returns NULL (prevented g_variant_new_string crash)
- valid UUID produces correct identity bytes
R3: gallery matching by subtype (3 tests)
- matches correct print by finger subtype
- falls back to first entry when subtype not found
- returns NULL for empty/NULL gallery
R4: struct field separation — enroll_user_dbid != delete_storage_dbid
R5: del_record command format — cmd 0x48 with dbid(2LE)
R6: match_finger single allocation — exactly 13 bytes
R7: SSM state enums exist (2 tests)
- CLEAR_* states 0-5
- DELETE_* states 0-7
To make the tests possible, extracted previously-static functions:
- parse_match_result → validity_parse_match_result (public)
- ValidityMatchResult struct moved to validity_db.h
- validity_match_result_clear added to validity_db.c
- validity_find_gallery_match helper extracted from verify SSM
|
2026-04-10 22:18:43 +00:00 |
|