Exemplo n.º 1
0
func doTest(t *Test, f norm.Form, gold, test string) {
	result := f.Bytes([]byte(test))
	cmpResult(t, "Bytes", f, gold, test, string(result))
	for i := range test {
		out := f.Append(f.Bytes([]byte(test[:i])), []byte(test[i:])...)
		cmpResult(t, fmt.Sprintf(":Append:%d", i), f, gold, test, string(out))
	}
	cmpIsNormal(t, "IsNormal", f, test, f.IsNormal([]byte(test)), test == gold)
}
Exemplo n.º 2
0
func doTest(t *Test, f norm.Form, gold, test string) {
	result := f.Bytes([]byte(test))
	cmpResult(t, "Bytes", f, gold, test, string(result))
	sresult := f.String(test)
	cmpResult(t, "String", f, gold, test, sresult)
	acc := []byte{}
	i := norm.Iter{}
	i.InitString(f, test)
	for !i.Done() {
		acc = append(acc, i.Next()...)
	}
	cmpResult(t, "Iter.Next", f, gold, test, string(acc))
	for i := range test {
		out := f.Append(f.Bytes([]byte(test[:i])), []byte(test[i:])...)
		cmpResult(t, fmt.Sprintf(":Append:%d", i), f, gold, test, string(out))
	}
	cmpIsNormal(t, "IsNormal", f, test, f.IsNormal([]byte(test)), test == gold)
}
Exemplo n.º 3
0
func doTest(t *Test, f norm.Form, gold, test string) {
	result := f.Bytes([]byte(test))
	cmpResult(t, "Bytes", f, gold, test, string(result))
	sresult := f.String(test)
	cmpResult(t, "String", f, gold, test, sresult)
	buf := make([]byte, norm.MaxSegmentSize)
	acc := []byte{}
	i := norm.Iter{}
	i.SetInputString(f, test)
	for !i.Done() {
		n := i.Next(buf)
		acc = append(acc, buf[:n]...)
	}
	cmpResult(t, "Iter.Next", f, gold, test, string(acc))
	for i := range test {
		out := f.Append(f.Bytes([]byte(test[:i])), []byte(test[i:])...)
		cmpResult(t, fmt.Sprintf(":Append:%d", i), f, gold, test, string(out))
	}
	cmpIsNormal(t, "IsNormal", f, test, f.IsNormal([]byte(test)), test == gold)
}
Exemplo n.º 4
0
func (src *source) properties(f norm.Form) norm.Properties {
	if src.bytes == nil {
		return f.PropertiesString(src.str)
	}
	return f.Properties(src.bytes)
}