lbcd/claimtrie/normalization/normalizer_icu_test.go
Brannon King ca18f3e8a2 fix bad rune handling
formatting
2021-08-19 17:52:01 -04:00

31 lines
No EOL
724 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// +build use_icu_normalization
package normalization
import (
"encoding/hex"
"github.com/stretchr/testify/assert"
"testing"
"unicode/utf8"
)
func TestNormalizationICU(t *testing.T) {
testNormalization(t, normalizeICU)
}
func BenchmarkNormalizeICU(b *testing.B) {
benchmarkNormalize(b, normalizeICU)
}
func TestBlock760150(t *testing.T) {
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)
}