kothar / brotli-go

Not maintained -> see itch.io's more up-to-date fork 👉
https://github.com/itchio/go-brotli
MIT License
82 stars 9 forks source link

Reader doesn't seem to be flushing properly #13

Closed dsnet closed 8 years ago

dsnet commented 8 years ago

Nice work on this cgo wrapper :) I'm using it as a comparison to benchmark my implementation.

In the meantime, the Reader is crashing my unit tests. (I verified that the writer is working since my decoder can read the output).

--- FAIL: TestCGoRoundTripBrotli (0.26s)
    common_test.go:59: test 0, zeros.bin:6:1000000: mismatching count: got 32768, want 1000000
    common_test.go:62: test 0, zeros.bin:6:1000000: mismatching checksum: got 0x011ffca6, want 0x0f410f3f
    common_test.go:59: test 1, random.bin:6:1000000: mismatching count: got 262144, want 1000000
    common_test.go:62: test 1, random.bin:6:1000000: mismatching checksum: got 0x91beb9df, want 0xcd5e034f
    common_test.go:59: test 2, binary.bin:6:1000000: mismatching count: got 65536, want 1000000
    common_test.go:62: test 2, binary.bin:6:1000000: mismatching checksum: got 0x681cc440, want 0xfc1091d8
    common_test.go:59: test 3, huffman.txt:6:1000000: mismatching count: got 229376, want 1000000
    common_test.go:62: test 3, huffman.txt:6:1000000: mismatching checksum: got 0x2cdba6dd, want 0x44a993e0
    common_test.go:59: test 4, digits.txt:6:1000000: mismatching count: got 131072, want 1000000
    common_test.go:62: test 4, digits.txt:6:1000000: mismatching checksum: got 0xd2a117ed, want 0x41db1af3
    common_test.go:59: test 5, twain.txt:6:1000000: mismatching count: got 98304, want 1000000
    common_test.go:62: test 5, twain.txt:6:1000000: mismatching checksum: got 0x3f8120eb, want 0xe6a0db63
FAIL
exit status 1
FAIL    _/home/rawr/Projects/compress/internal/benchmark    1.239s

The fact that its only outputting data the size of 1<<15 indicates to me that its some type of flushing issue.

How to reproduce:

go get github.com/dsnet/compress/internal/benchmark
go test github.com/dsnet/compress/internal/benchmark
dsnet commented 8 years ago

Fixed in master.