...
1 package tests
2
3 import (
4 "fmt"
5 "github.com/xrash/smetrics"
6 "testing"
7 )
8
9 func TestSoundex(t *testing.T) {
10 cases := []soundexcase{
11 {"Euler", "E460"},
12 {"Ellery", "E460"},
13 {"Gauss", "G200"},
14 {"Ghosh", "G200"},
15 {"Hilbert", "H416"},
16 {"Heilbrohn", "H416"},
17 {"Knuth", "K530"},
18 {"Kant", "K530"},
19 {"Lloyd", "L300"},
20 {"Ladd", "L300"},
21 {"Lukasiewicz", "L222"},
22 {"Lissjous", "L222"},
23 {"Ravi", "R100"},
24 {"Ravee", "R100"},
25 }
26
27 for _, c := range cases {
28 if r := smetrics.Soundex(c.s); r != c.t {
29 fmt.Println(r, "instead of", c.t, "for", c.s)
30 t.Fail()
31 }
32 }
33 }
34
View as plain text