uttrflow / uttrflow/uttrflow-swift
Test "point oh" decimals and "number zero" in the rules-based tidying passes
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## What happens
Two small branches in the rules engine have never run:
- `Sources/UttrflowAI/Passes/NumberFormsPass.swift:201`: `singleDigit` reads "oh" as `0` after "point", as in "three point oh five". The existing "two oh five pm" case goes through the time path, not this one. Line 192, a "point" whose next word isn't joined to it, is also unexercised.
- `Sources/UttrflowAI/Passes/LayoutWordsPass.swift:95` and `:99`: `itemNumber` refuses item number 0, written ("number 0") or spoken ("number zero"), so those don't start a numbered list.
Measured on origin/main `26d7bc1` with `swift test --enable-code-coverage` (5,384 tests, all passing) and `xcrun llvm-cov export` over the test binary. The regions named below have an execution count of 0: no test runs them, so a change that breaks them passes `make verify`.
## Why it matters
People read version numbers and measurements aloud as "point oh" all the time. If the "oh" branch goes, "3.05" comes out as "3. oh five". The zero guard stops "number zero" (a real phrase: "patient number zero") from being turned into a list item "0.".
## How to reproduce
Run `swift test --enable-code-coverage`, then `xcrun llvm-cov show -instr-profile .build/debug/codecov/default.profdata .build/debug/UttrflowPackageTests.xctest/Contents/MacOS/UttrflowPackageTests Sources/UttrflowAI/Passes/NumberFormsPass.swift` and look for the `0` counts on the lines named above.
## Acceptance criteria
- `NumberFormsPassTests` gains cases such as ("version three point oh five", "version 3.05"), plus one where "point" is followed by a pause mark so it stays a word.
- `LayoutWordsPassTests` gains cases where "number zero ..." and "number 0 ..." are left as written.
- Each new test fails when the branch it covers is broken. Check this by hand before opening the PR: temporarily change the branch (flip the condition or return the other value), see the test fail, then restore it.
## Where to start
- `Tests/UttrflowAITests/Passes/NumberFormsPassTests.swift` and `Tests/UttrflowAITests/Passes/LayoutWordsPassTests.swift`. Both are table-driven, so each case is one line.
- `Docs/cleanup.md` describes both passes.
Read `CONTRIBUTING.md` first. Iterate with `swift test --filter `, then run `make verify` before pushing. Only tests change; no product code needs to.
**Size:** S, under an hour.
Contributor guide
Research direction
Read CONTRIBUTING.md, then inspect the table-driven cases in Tests/UttrflowAITests/Passes/NumberFormsPassTests.swift and LayoutWordsPassTests.swift; Docs/cleanup.md describes the passes. Run each suite with swift test --filter and verify the new decimal and zero-number cases fail when their branches are temporarily reversed, then run make verify. Done means only the requested tests are added and both uncovered branches are exercised.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 92/100