kisielk / og-rek

ogórek is a Go library for encoding and decoding pickles.
MIT License
60 stars 16 forks source link

decoder: Cleanup decodeLong tests #43

Closed navytux closed 6 years ago

navytux commented 6 years ago

Instead of copy-pasting full test driver for each value, make it to be only one test with many values in table each tested by common driver.

TestZeroLengthData was checking output.BitLen() == 0 which is another way to test for equality with big.Int(0) according to

https://golang.org/pkg/math/big/#Int.BitLen

So join it too to the rest of decodeLong tests.

While at decodeLong topic, rename BenchmarkSpeed -> BenchmarkDecodeLong as this benchmark checks speed of decodeLong only, nothing else.

kisielk commented 6 years ago

Much better, thanks.

navytux commented 6 years ago

Thanks