func (src *source) properties(f norm.Form) norm.Properties { if src.bytes == nil { return f.PropertiesString(src.str) } return f.Properties(src.bytes) }
func doTest(t *Test, f norm.Form, gold, test string) { testb := []byte(test) result := f.Bytes(testb) 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)) buf := make([]byte, 128) acc = nil for p := 0; p < len(testb); { nDst, nSrc, _ := f.Transform(buf, testb[p:], true) acc = append(acc, buf[:nDst]...) p += nSrc } cmpResult(t, "Transform", 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) cmpIsNormal(t, "IsNormalString", f, test, f.IsNormalString(test), test == gold) }