-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbytes_test.go
More file actions
38 lines (34 loc) · 907 Bytes
/
bytes_test.go
File metadata and controls
38 lines (34 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package decompressor
import (
"reflect"
"testing"
)
func TestToBytes(t *testing.T) {
for _, tt := range initTestCases() {
t.Run(tt.name, func(t *testing.T) {
defer func() {
r := recover()
if (r != nil) != tt.wantErr {
t.Errorf("ToBytes() should panic = %v, but it did = %v", tt.wantErr, r != nil)
}
}()
if gotRes := ToBytes(tt.compressType, tt.arg); !reflect.DeepEqual(gotRes, tt.want) {
t.Errorf("ToBytes() = %v, want %v", gotRes, tt.want)
}
})
}
}
func TestToBytesWithErr(t *testing.T) {
for _, tt := range initTestCases() {
t.Run(tt.name, func(t *testing.T) {
got, err := ToBytesWithErr(tt.compressType, tt.arg)
if (err != nil) != tt.wantErr {
t.Errorf("ToBytesWithErr() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("ToBytesWithErr() = %v, want %v", got, tt.want)
}
})
}
}