aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/util/util_test.go
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2025-06-27 13:41:07 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2025-06-27 14:16:35 -0400
commitf795d47d4c0cef03a410fb1001bae6819f9ba41f (patch)
treeb311168aa52bda183affde023b9fc4c45ed6d880 /pkg/util/util_test.go
parent916430e5d3f33a24b13e188428d5335862472411 (diff)
Add Levenshtein distance util
Diffstat (limited to 'pkg/util/util_test.go')
-rw-r--r--pkg/util/util_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/util/util_test.go b/pkg/util/util_test.go
new file mode 100644
index 0000000..36bb5c9
--- /dev/null
+++ b/pkg/util/util_test.go
@@ -0,0 +1,26 @@
+package util_test
+
+import (
+ "github.com/jpappel/atlas/pkg/util"
+ "testing"
+)
+
+func TestLevensteinDistance(t *testing.T) {
+ tests := []struct {
+ s string
+ t string
+ want int
+ }{
+ {"sitting", "kitten", 3},
+ {"Saturday", "Sunday", 3},
+ {"hello", "kelm", 3},
+ }
+ for _, tt := range tests {
+ t.Run(tt.s+" "+tt.t, func(t *testing.T) {
+ got := util.LevensteinDistance(tt.s, tt.t)
+ if got != tt.want {
+ t.Errorf("LevensteinDistance() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}