code wiki / (root) / fuzz_lex_test.nx

fuzz_lex_test.nx

buildroot/runtime/fuzz_lex_test.nx

3384 B97 linesdepth 4pulls 9 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

fuzz_lex_test.nx -- mutational fuzz against lex_source. Mutates valid NishiLang sources and feeds them to the lexer. The lexer should ALWAYS return without crashing -- malformed input may produce unexpected tokens, but it must never dereference NULL or run off the end of the buffer. This turns the theoretical "lex_source is robust" claim into an empirical "we've tried 10,000 mutated inputs and none crashed" result. If any run DOES crash, nx_assert fires and we get a clean post-mortem + the exact seed for replay. Seed corpus: "func f() { return 42 }" -- minimal function "let x: i64 = 100" -- let statement "0xdeadbeef + 0b1010" -- mixed-base integers "\"hello world\"" -- string literal "if a < b { x = 1 }" -- control flow "x[0].field" -- postfix chain "// comment\nfunc g() {}" -- comment handling "0.5 + 3.14f" -- floating-point literals

dependencies 5 imports · 0 importers

syscalls.nx types.nx lex_kinds.nx lex.nx nx_fuzz.nx fuzz_lex_test.nx

imports: syscalls.nxtypes.nxlex_kinds.nxlex.nxnx_fuzz.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_fuzz_new nx_fuzz_add_seed

structs

none

consts

29const FUZZ_ITERS: i64 = 10000
30const FUZZ_MAX_INPUT: i64 = 1024

functions

32func main() -> i64 {