Skip to content

Test the 1 untested function in specs/fpga/testbench.t27 #4451

Description

@github-actions

Test the 1 untested function in specs/fpga/testbench.t27

Context

t27c coverage specs/fpga/testbench.t27 says this file declares 15 functions and 1 of them has no test. A function with no test is a claim: it compiles, it generates, and nothing in this repository says what it is supposed to do.

.t27 is the hand-authored source language. t27c compiles it out to C, Rust, Verilog and Zig. You are writing source, not compiler output, and not prose about an implementation.

Before you write a function, ask whether it already exists. 576 of the 4021 function bodies in specs/ are byte-identical copies of another one - magadd written 30 times, sadd 29 - because nothing told the agent writing them that the function was already there.

If it already exists, do not copy it and do not try to import it. Cross-module reuse does not generate yet: use other::fn; compiles to a comment and an unqualified call, and the Zig fails with use of undeclared identifier. Say so in your report instead - name the file and line where the function lives and state that this spec needs it - and implement only what this spec's own criteria ask for. Duplicate Body Ratchet fails a pull request that adds a new copy, and 576 of 4021 bodies here are already copies, each of which has to be fixed everywhere it was written.

The compiler answers more questions than grep does. Every one of these reads the file and prints; none of them writes. Run them from the repository root, with <spec> replaced by the file named in ## Boundary:

.t27 is not Rust and not Zig, and a bee fluent in either writes one by
accident. Measured 2026-09-20: a bee filled eight bodies in
specs/file/watcher.t27 with return Ok(());, Err(FileError::WatcherNotFound)
and for i in 0..watchers.length. The parse ratchet refused the whole file --
Unexpected token in expression: RParen, line 123 -- and a spec that does not
parse generates nothing, so every test it already carried stopped running.

At the top level the parser accepts exactly these eight forms, with an optional
pub, and no others:

const   var   fn   enum   struct   test   invariant   bench

There is no trait, no impl, no type X = ..., no generics, no macro. What
a bee reaches for from another language, and what happens:

  • Rust's result sugar (Ok(()), Err(E::V), ?) is not a construct here.
  • Rust macros (println!, format!, vec!) are not constructs here.
  • A range loop (for i in 0..n) is Rust and Zig, not this language.
  • Zig builtins (catch unreachable, @intCast, @constCast) are not constructs here.
  • Cross-module reuse (use other::fn;) parses and then generates a comment and an unqualified call, so the Zig fails with use of undeclared identifier (use a::b; generates no import, so no spec can reuse a function from another spec #4298). It does not work yet.

t27c parse <spec> answers in one line whether what you wrote is the language.
Run it before you report, every time.

  • t27c spec-status <spec> - the compiler's one-word verdict: IMPLEMENTED, PARTIAL, UNWRITTEN, NOPARSE, NOFN. Exit code is 0 whatever it says, so read the word.
  • t27c symbols <spec> - every name the file declares, with its kind. Answers "does this already exist here?" before you add it.
  • t27c outline <spec> - per function: its locals, what it calls, what it returns. The contract you are implementing against.
  • t27c coverage <spec> - which functions have a test and which do not. The issue asks for tests; this is how you check you wrote them.
  • t27c lint <spec> - style and shape warnings. It OVER-REPORTS has no test or invariant: measured 2026-09-20 over 60 specs it printed 677 of those where coverage found 190 untested functions, disagreeing on 59 of the 60 - it warns about bit_to_trit_pair in specs/base/ternary_encoding.t27, which test bit_to_trit_pair_zero calls on line 249. Read it as a hint; coverage is the answer.
  • t27c typecheck <spec> - types, before generation. Prints Typecheck OK (0 errors, 0 warnings) or the errors.
  • t27c test-report <spec> - builds this spec and runs its own tests, which is what the oracle does. BLOCKED means the generated Zig does not compile, with the error beside it.
  • python3 tools/dupe_scan.py --name <function> - where that function already lives, if it does. 576 of 4021 bodies here are byte-identical copies.

Check yourself with t27c test-report before you report. It builds this spec and runs its own tests, which is what the review does. BLOCKED means the generated Zig does not compile, and the error is printed beside it. If the block comes from something outside this file, say so in your report and name the error rather than working around it. The rest of the toolbelt is in docs/BEE_TOOLBELT.md.

Current state - re-run these yourself, from the repository root

$ t27c coverage specs/fpga/testbench.t27
Functions: 15
Untested:  1

User Scenarios & Testing

  • Given specs/fpga/testbench.t27, where 1 of its 15 functions has no test,
    when stim_count_before is written and the commands under Acceptance criteria are run from the repository root,
    then each of those commands prints the value stated beside it.

Requirements

  • FR-001: every signature quoted below MUST stay exactly as it is - the signature is the contract, and a caller elsewhere is holding it.
  • FR-002: the spec MUST still parse afterwards. t27c parse is the check, and a spec that stops parsing generates nothing, so every test it already carried stops running too.
  • FR-003: no function MUST be deleted to satisfy a count. The function count is itself a criterion below.
  • FR-004: each test MUST assert on a result. assert true and a body of only comments are counted as vacuous by t27c validate-vacuity, and the corpus ratchet fails a file that gains one.

What has no test

Quoted verbatim from the file - keep every signature exactly as it is:

  1. fn stim_count_before(stimuli: [TbStimulus], count: u32, cycle: u32) -> u32

The file already has 16 test declaration(s). Write one for each function above. Either spelling is accepted: test name { or test "name" {.

A test that asserts nothing is not coverage. assert true and a body of only comments are both counted as vacuous by t27c validate-vacuity, and the corpus ratchet fails a file that gains one.

Acceptance criteria

    1. t27c coverage specs/fpga/testbench.t27 2>&1 | grep -cE '^Untested: +0$' prints 1 (today: 0 - it prints Untested: 1)
    1. grep -cE '^[[:space:]]*(pub[[:space:]]+)?fn[[:space:]]' specs/fpga/testbench.t27 prints 15 - the same functions are still there (deleting a function also makes it untested-free)
    1. grep -cE '^[[:space:]]*test[[:space:]]+("|[A-Za-z_])' specs/fpga/testbench.t27 prints at least 17 (today: 16)
    1. t27c spec-status specs/fpga/testbench.t27 prints IMPLEMENTED (today: IMPLEMENTED)
    1. t27c test-report specs/fpga/testbench.t27 2>&1 | grep -c BLOCKED prints 0 - this spec compiles today and must still compile (today: 0)

Boundary

specs/fpga/testbench.t27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions