You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
351 B
Go
24 lines
351 B
Go
4 years ago
|
package codec
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestGzip(t *testing.T) {
|
||
|
var buf bytes.Buffer
|
||
|
for i := 0; i < 10000; i++ {
|
||
|
fmt.Fprint(&buf, i)
|
||
|
}
|
||
|
|
||
|
bs := Gzip(buf.Bytes())
|
||
|
actual, err := Gunzip(bs)
|
||
|
|
||
|
assert.Nil(t, err)
|
||
|
assert.True(t, len(bs) < buf.Len())
|
||
|
assert.Equal(t, buf.Bytes(), actual)
|
||
|
}
|