func BenchmarkRunListEncode(b *testing.B) { runlist := NewRunList() runlist.Update(testhelpers.RandomRunData(100000)) b.ResetTimer() for i := 0; i < b.N; i++ { runlist.Encode() } }
func BenchmarkRunListUpdate(b *testing.B) { data := testhelpers.RandomRunData(100000) b.ResetTimer() for i := 0; i < b.N; i++ { runlist := NewRunList() runlist.Update(data) } }
func TestFilledBlock(t *testing.T) { var buf bytes.Buffer var out bytes.Buffer expected := testhelpers.RandomRunData(baseBlockSize) writer, _ := NewWriterLevel(&buf, 1) _, err := writer.Write(expected) if err == nil { err = writer.Close() } if err != nil { t.Fatal(err) } reader := bzip2.NewReader(&buf) _, err = io.Copy(&out, reader) if err != nil { t.Fatal(err) } if out.String() != string(expected) { t.Error("Output is incorrect.") } }