func BenchmarkFR32k(b *testing.B) { for _, t := range tests { reader := NewReader(t.fn) buf := new(bytes.Buffer) io.CopyN(buf, reader, 32*1024) for n := 0; n < b.N; n++ { franco.DetectOne(buf.String()) } } }
func TestFR(t *testing.T) { for _, c := range tests { reader := NewReader(c.fn) buf := new(bytes.Buffer) for _, size := range []int64{8192, 32768} { io.CopyN(buf, reader, size) result := franco.DetectOne(buf.String()) code := iso3to2[result.Code] if !stringInSlice(code, c.lang) { t.Errorf("%s: got %s, want one of %+v", c.fn, code, c.lang) } } } }