parse_test.go 371 Bytes
Newer Older
Kejie Zhang's avatar
Kejie Zhang committed
1 2 3 4
package chunk

import (
	"bytes"
Kejie Zhang's avatar
Kejie Zhang committed
5
	"testing"
Kejie Zhang's avatar
Kejie Zhang committed
6 7 8 9 10 11 12 13 14 15 16 17
)

func TestParse(t *testing.T) {
	max := 1000
	r := bytes.NewReader(randBuf(t, max))
	chk1 := "rabin-18-25-32"
	chk2 := "rabin-15-23-31"
	_, err := parseRabinString(r, chk1)
	if err != nil {
		t.Errorf(err.Error())
	}
	_, err = parseRabinString(r, chk2)
Kejie Zhang's avatar
Kejie Zhang committed
18 19
	if err == ErrRabinMin {
		t.Log("it should be ErrRabinMin here.")
Kejie Zhang's avatar
Kejie Zhang committed
20
	}
Kejie Zhang's avatar
Kejie Zhang committed
21
}