code wiki / _hdl_build / nx_gatequality.nx
nx_gatequality.nx
buildroot/runtime/_hdl_build/nx_gatequality.nx
about
nx_gatequality.nx -- HOW MUCH OF AN ORGAN ITS GATE ACTUALLY EXERCISES.
===== WHY THIS EXISTS ============================================
nx_gatescan answers "does anything test this file". That question has a
blind spot large enough to have hidden a real defect in this tree: a gate
touching four of an organ's twelve functions counts as a gate, so the organ
reads as covered.
That is exactly what happened in the food-chemistry lane. A neighbouring
gate imported the ingredient catalog and exercised si_name,
si_density_mg_per_ml, si_capsule_fill_mg and si_cost_is_indicative -- the
packaging and cost helpers. si_class and si_is_lawful_dietary, the two
functions deciding whether a substance may LAWFULLY BE SOLD, were
exercised by nothing at all, and the scan reported the file as gated.
★COVERAGE ACCUMULATES AROUND WHATEVER A NEIGHBOUR HAPPENED TO NEED, so the
most consequential function in a file is frequently the least checked.
Existence is the wrong question. This organ asks the other one.
===== THE MEASUREMENT ============================================
1. From each organ, extract its top-level `func` definitions.
2. Find the gates attributed to it (same rule as nx_gatescan: the organ
stem followed by an underscore, ending _test.nx or _gate.nx).
3. In each gate, look for a real reference to each function name.
4. Coverage = referenced / defined, unioned across all of that organ's
gates -- an organ tested by three files is covered by their union.
★★COMMENTS ARE STRIPPED BEFORE MATCHING, AND THAT IS NOT A DETAIL. Gates
in this tree carry long explanatory headers that NAME the functions they
discuss. Matching raw text would count a function as exercised because
its own gate mentioned it in prose -- and the worse the coverage, the more
likely someone wrote a comment about it. The measurement would have been
anti-correlated with the truth.
★MATCHING IS TOKEN-EXACT. A substring match would count si_class as
covered by a reference to si_class_of, which is how a coverage tool starts
reporting numbers that are reassuring and false.
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_eco_graph.nxnx_gatelib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 55 | const GQ_MAGIC_4096: i64 = 4096 |
| 57 | const GQ_MAXNODE: i64 = 24000 |
| 58 | const GQ_MAXEDGE: i64 = 8 |
| 59 | const GQ_ARENA: i64 = 4194304 |
| 60 | const GQ_HASH: i64 = 65536 |
| 61 | const GQ_FILECAP: i64 = 262144 |
| 62 | const GQ_PATHARENA: i64 = 4194304 |
| 67 | const GQ_MAXFUNCS: i64 = 64 |
functions
| 69 | func gw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 70 | func gn(v: i64) -> i64 { let b: *u8 = sys_mmap(24); var m: i64 = v; if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } let t: *u8 = sys_mmap(24); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { b[i] = t[k - 1 - i]; i = i + 1 } sys_write(1, b, k); return 0 } |
| 104 | func gq_close_reach(src: *u8, n: i64, names: *u8, offs: *i64, lens: *i64, spans: *i64, fc: i64, seed: i64) -> i64 |
| 140 | func main(argc: i64, argv: *i64) -> i64 |