diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-05-08 15:40:48 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-05-08 16:38:25 +0800 |
commit | 82defe5c5663ca0c28563f8a111d327c87726267 (patch) | |
tree | b4b1ffccc0ceaa6f1a22eb0417afd88d8adbefac /common/bitutil/compress_fuzz.go | |
parent | cf19586cfbe5aa379c8fdb046dc5a8c0fa1cebbb (diff) | |
download | go-tangerine-82defe5c5663ca0c28563f8a111d327c87726267.tar go-tangerine-82defe5c5663ca0c28563f8a111d327c87726267.tar.gz go-tangerine-82defe5c5663ca0c28563f8a111d327c87726267.tar.bz2 go-tangerine-82defe5c5663ca0c28563f8a111d327c87726267.tar.lz go-tangerine-82defe5c5663ca0c28563f8a111d327c87726267.tar.xz go-tangerine-82defe5c5663ca0c28563f8a111d327c87726267.tar.zst go-tangerine-82defe5c5663ca0c28563f8a111d327c87726267.zip |
common/compress: internalize encoders, add length wrappers
Diffstat (limited to 'common/bitutil/compress_fuzz.go')
-rw-r--r-- | common/bitutil/compress_fuzz.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/common/bitutil/compress_fuzz.go b/common/bitutil/compress_fuzz.go index 2b7fe2977..1b87f50ed 100644 --- a/common/bitutil/compress_fuzz.go +++ b/common/bitutil/compress_fuzz.go @@ -20,36 +20,36 @@ package bitutil import "bytes" -// Fuzz implements a go-fuzz fuzzer method to test various compression method +// Fuzz implements a go-fuzz fuzzer method to test various encoding method // invocations. func Fuzz(data []byte) int { if len(data) == 0 { return -1 } if data[0]%2 == 0 { - return fuzzCompress(data[1:]) + return fuzzEncode(data[1:]) } - return fuzzDecompress(data[1:]) + return fuzzDecode(data[1:]) } -// fuzzCompress implements a go-fuzz fuzzer method to test the bit compression and -// decompression algorithm. -func fuzzCompress(data []byte) int { - proc, _ := DecompressBytes(CompressBytes(data), len(data)) +// fuzzEncode implements a go-fuzz fuzzer method to test the bitset encoding and +// decoding algorithm. +func fuzzEncode(data []byte) int { + proc, _ := bitsetDecodeBytes(bitsetEncodeBytes(data), len(data)) if !bytes.Equal(data, proc) { panic("content mismatch") } return 0 } -// fuzzDecompress implements a go-fuzz fuzzer method to test the bit decompression -// and recompression algorithm. -func fuzzDecompress(data []byte) int { - blob, err := DecompressBytes(data, 1024) +// fuzzDecode implements a go-fuzz fuzzer method to test the bit decoding and +// reencoding algorithm. +func fuzzDecode(data []byte) int { + blob, err := bitsetDecodeBytes(data, 1024) if err != nil { return 0 } - if comp := CompressBytes(blob); !bytes.Equal(comp, data) { + if comp := bitsetEncodeBytes(blob); !bytes.Equal(comp, data) { panic("content mismatch") } return 0 |