Goal
Add table-driven tests for the decimal-string grammar that ordered fact comparisons require.
Why
Core §2.2 fixes the operand form for greater-than, greater-than-or-equal, less-than and less-than-or-equal:
decimal = [ "-" ] ( "0" / non-zero-digit *DIGIT ) [ "." 1*DIGIT ]
That grammar refuses a leading +, a leading zero such as 007, a bare .5, a trailing 5., an exponent, whitespace, and an empty string — and it accepts -0.5 and 0.10. It also exists because JSON numbers are the wrong carrier for a business quantity whose decimal identity matters, which is a decision worth having pinned by cases rather than by prose.
The evaluator implements it. What is thin is a set of tests that walk the grammar's edges deliberately, one accepted and one rejected value per rule.
Scope
- Change test files under
internal/evaluation/ only.
- Table-driven, with
t.Run per case, covering at least: leading +, leading zeros, bare .5, trailing 5., exponent forms, internal or surrounding whitespace, empty string, -0, and a value with more fractional digits than the operand it is compared against.
- Assert the diagnostic each rejection produces, not merely that it was rejected.
- Do not change the grammar, the evaluator, or any schema.
Acceptance criteria
Contributor learning
Why a specification carries an explicit decimal grammar instead of using JSON numbers, and how to test a grammar at its edges rather than in its middle.
Goal
Add table-driven tests for the decimal-string grammar that ordered
factcomparisons require.Why
Core §2.2 fixes the operand form for
greater-than,greater-than-or-equal,less-thanandless-than-or-equal:That grammar refuses a leading
+, a leading zero such as007, a bare.5, a trailing5., an exponent, whitespace, and an empty string — and it accepts-0.5and0.10. It also exists because JSON numbers are the wrong carrier for a business quantity whose decimal identity matters, which is a decision worth having pinned by cases rather than by prose.The evaluator implements it. What is thin is a set of tests that walk the grammar's edges deliberately, one accepted and one rejected value per rule.
Scope
internal/evaluation/only.t.Runper case, covering at least: leading+, leading zeros, bare.5, trailing5., exponent forms, internal or surrounding whitespace, empty string,-0, and a value with more fractional digits than the operand it is compared against.Acceptance criteria
env GO111MODULE=on go test ./internal/evaluationandgo test ./...pass.git commit -s.Contributor learning
Why a specification carries an explicit decimal grammar instead of using JSON numbers, and how to test a grammar at its edges rather than in its middle.