Exemplo n.º 1
0
// genTree generate radix.Tree which has specified length
func genTree(length, keyLen, valueLen int) *radix.Tree {
	g := dummy.NewGenerator()
	t := radix.New()
	for i := 0; i < length; i++ {
		t.Insert(g.String(keyLen), g.String(valueLen))
	}
	return t
}
Exemplo n.º 2
0
// genTreeTSV generate tsv for building tree.
func genTreeTSV(length, keyLen, valueLen int) io.Reader {
	g := dummy.NewGenerator()
	var buf bytes.Buffer
	for i := 0; i < length; i++ {
		buf.WriteString(g.String(keyLen))
		buf.WriteString("\t")
		buf.WriteString(g.String(valueLen))
		buf.WriteString("\n")
	}
	return &buf
}