diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2026-02-08 22:47:02 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2026-02-08 22:47:02 -0500 |
| commit | 2b7e96835e75e0d153e7f993d1c4fc2add452ddd (patch) | |
| tree | ed1104f60ed35af2bf3c9d8cd66d17f45683f07c /test | |
| parent | 2371542adb017afc87ecc572901107bf493e214f (diff) | |
Added Text.distance(a,b) for text similarity comparisons.
Diffstat (limited to 'test')
| -rw-r--r-- | test/text.tm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/text.tm b/test/text.tm index 6c23042d..8f0da922 100644 --- a/test/text.tm +++ b/test/text.tm @@ -208,3 +208,11 @@ func main() assert "one two".find("two") == 5 assert "one two".find("three") == none assert "one two".find("o", start=2) == 7 + + + assert "hello".distance("hello") == 0 + assert "hello".distance("goodbye") > 2.0 + assert "hello".distance("hola") < "hello".distance("goodbye") + assert "hello".distance("Hello") <= 1.0 + assert "hello".distance("xello") <= 1.0 + assert "hello".distance("ehllo") <= "hello".distance("XXllo") |
