File: soundex_test.go

package info (click to toggle)
golang-github-xrash-smetrics 0.0~git20170218.a3153f7-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,076 kB
  • sloc: makefile: 9
file content (33 lines) | stat: -rw-r--r-- 572 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
package tests

import (
	"fmt"
	"github.com/xrash/smetrics"
	"testing"
)

func TestSoundex(t *testing.T) {
	cases := []soundexcase{
		{"Euler", "E460"},
		{"Ellery", "E460"},
		{"Gauss", "G200"},
		{"Ghosh", "G200"},
		{"Hilbert", "H416"},
		{"Heilbrohn", "H416"},
		{"Knuth", "K530"},
		{"Kant", "K530"},
		{"Lloyd", "L300"},
		{"Ladd", "L300"},
		{"Lukasiewicz", "L222"},
		{"Lissjous", "L222"},
		{"Ravi", "R100"},
		{"Ravee", "R100"},
	}

	for _, c := range cases {
		if r := smetrics.Soundex(c.s); r != c.t {
			fmt.Println(r, "instead of", c.t)
			t.Fail()
		}
	}
}