aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/util/util_test.go
blob: 36bb5c9b12fae81862a039b1b26ff5a48c721a7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
			}
		})
	}
}