diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2025-06-27 13:41:07 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2025-06-27 14:16:35 -0400 |
| commit | f795d47d4c0cef03a410fb1001bae6819f9ba41f (patch) | |
| tree | b311168aa52bda183affde023b9fc4c45ed6d880 /pkg/util/util_test.go | |
| parent | 916430e5d3f33a24b13e188428d5335862472411 (diff) | |
Add Levenshtein distance util
Diffstat (limited to 'pkg/util/util_test.go')
| -rw-r--r-- | pkg/util/util_test.go | 26 |
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) + } + }) + } +} |
