code wiki / _hdl_build / nx_gatelib_test.nx
nx_gatelib_test.nx
buildroot/runtime/_hdl_build/nx_gatelib_test.nx
about
nx_gatelib_test.nx -- the gate the extracted library needed immediately.
★DE-DUPLICATING CREATED A NEW UNGATED LOAD-BEARING ORGAN. Folding nine
duplicated functions into one library gave that library two consumers and
no test of its own -- precisely the class the consumers exist to find. A
refactor that removes duplication while adding unverified code has moved
the debt, not paid it.
⚠AND MY OWN SCANNER DID NOT SURFACE IT. With two consumers the library
scores severity 2, which ranks BELOW the fixed floor of 3 given to organs
nothing calls at all, so it sat under 5020 dead files in the ranking. A
load-bearing organ with two consumers matters MORE than a dead one with
none, and the ranking said the opposite. Filed against nx_gatescan and
noted here because the tool found nothing while the defect was real.
This gate calls the library DIRECTLY. The two consumer gates keep their
own independent re-derivations of the same rules, and that is deliberate:
a direct unit test proves the library does what it says, while a separate
implementation agreeing proves the rule itself is right. They answer
different questions and neither replaces the other.
expect_exit: 0 license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_gatelib.nxnx_gate.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
| none |
functions
| 26 | func tw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 27 | func tn(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 } |
| 29 | func main() -> i64 |