Unit test for the signature string parser.
This is one of the most important test files, as it exhaustively validates the correctness and robustness of the infix signature parser. It is divided into several subtests:
- Valid Single Types: Checks that a wide variety of correct, individual type signatures (primitives, pointers, arrays, aggregates) parse successfully and result in the expected
infix_type_category.
- Valid Edge Cases: Tests the parser's handling of non-standard but valid syntax, such as extra whitespace, comments, empty aggregates (
{}), and deeply nested pointer/function types.
- Valid Full Function Signatures: Uses
infix_signature_parse to test the parsing of complete function signatures, including variadic functions (with ;) and named arguments.
- Invalid Syntax and Logic: A large set of negative test cases that feed the parser deliberately malformed or logically invalid signatures (e.g.,
[10:void]). It verifies that the parser correctly fails for each case.
- Round Trip: A critical test that parses a signature, then uses
infix_type_print to serialize the resulting type object back into a string. It then verifies that the output string matches the canonical representation of the input, ensuring that parsing and printing are inverse operations.