lbcd/claimtrie/normalization/normalizer_icu_test.go

31 lines
724 B
Go
Raw Normal View History

// +build use_icu_normalization
package normalization
import (
2021-08-19 16:40:37 -04:00
"encoding/hex"
"github.com/stretchr/testify/assert"
"testing"
2021-08-19 16:40:37 -04:00
"unicode/utf8"
)
func TestNormalizationICU(t *testing.T) {
testNormalization(t, normalizeICU)
}
func BenchmarkNormalizeICU(b *testing.B) {
benchmarkNormalize(b, normalizeICU)
}
func TestBlock760150(t *testing.T) {
2021-08-19 16:40:37 -04:00
test, _ := hex.DecodeString("43efbfbd")
assert.True(t, utf8.Valid(test))
a := normalizeGo(test)
b := normalizeICU(test)
assert.Equal(t, a, b)
test2 := "Ꮖ---N---------N-Ꮹ----on-Instagram_-“Our-next-destination-is-East-and-Southeast-Asia--selfie--asia”"
a = normalizeGo([]byte(test2))
b = normalizeICU([]byte(test2))
assert.Equal(t, a, b)
}