fix(eval): accept multiplier-suffix numbers like 64x

The strict word-boundary rule rejected the multiplier form. A single
trailing x with no word character after it now counts as a valid
number. Hex literals and identifiers stay rejected.
This commit is contained in:
2026-08-17 01:57:58 +01:00
parent 1b29019325
commit 586700758f
2 changed files with 11 additions and 1 deletions
+3
View File
@@ -26,6 +26,9 @@ func TestExtractLastNumber(t *testing.T) {
{"platform qualifier with parenthetical acronym", "24 bytes on a 64-bit (LP64) platform.", 24, false},
{"digits glued into an identifier via underscore", "sizeof = 24 bytes on x86_64", 24, false},
{"digits glued into an identifier via hyphen (bogus sign)", "sizeof = 24 bytes on x86-64", 24, false},
{"multiplier suffix accepted", "The compression ratio is 64x.", 64, false},
{"multiplier suffix at end of text", "speedup: 8x", 8, false},
{"hex literal never a multiplier", "the flag is 0x2A so the answer is 42", 42, false},
{"hyphen-compound number accepted as a last resort", "It is a 24-byte struct.", 24, false},
// Documented limitation, not a regression: the heuristic has no
// notion of "the total" vs. "a breakdown component" and returns