1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 var strdata = []string{
24 var testCases = map[string]int{
39 func TestIndex(t *testing.T) {
40 index := Index(strings.Join(strdata, ""))
41 for k, v := range testCases {
42 if i := index.Index([]byte(k)); i != v {
43 t.Errorf("%s: got %d; want %d", k, i, v)
48 func TestFixCase(t *testing.T) {
50 "aaaa", "AbCD", "abcd",
51 "Zzzz", "AbCD", "Abcd",
58 for tc := tests; len(tc) > 0; tc = tc[3:] {
60 if !FixCase(tc[0], b) {
63 if string(b) != tc[2] {
64 t.Errorf("FixCase(%q, %q) = %q; want %q", tc[0], tc[1], b, tc[2])