1 // Copyright 2016 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.
10 "golang.org/x/text/internal/testtext"
13 var foldTestCases = []string{
15 "ab\u13fc\uab7aꭰ", // abᏴᎪᎠ
16 "affifflast", // affifflast
17 "Iİiı\u0345", // ii̇iıι
18 "µµΜΜςσΣΣ", // μμμμσσσσ
21 func TestFold(t *testing.T) {
22 for _, tc := range foldTestCases {
23 testEntry := func(name string, c Caser, m func(r rune) string) {
25 for _, r := range tc {
28 if got := c.String(tc); got != want {
29 t.Errorf("%s(%s) = %+q; want %+q", name, tc, got, want)
31 dst := make([]byte, 256) // big enough to hold any result
33 v := testtext.AllocsPerRun(20, func() {
34 c.Transform(dst, src, true)
37 t.Errorf("%s(%s): number of allocs was %f; want 0", name, tc, v)
40 testEntry("FullFold", Fold(), func(r rune) string {
41 return runeFoldData(r).full
44 // testEntry("SimpleFold", Fold(Compact), func(r rune) string {
45 // return runeFoldData(r).simple
47 // testEntry("SpecialFold", Fold(Turkic), func(r rune) string {
48 // return runeFoldData(r).special