-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompress_test.go
More file actions
56 lines (42 loc) · 827 Bytes
/
compress_test.go
File metadata and controls
56 lines (42 loc) · 827 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package utils
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestCompress(t *testing.T) {
t.Run("sometext", func(t *testing.T) {
plain := "sometext"
comp := Compress(plain)
var dec string
Decompress(comp, &dec)
require.Equal(t, dec, plain)
})
t.Run("empty", func(t *testing.T) {
type Dupa struct {
A string
B int
}
plain := Dupa{A: "a", B: 2}
comp := Compress(plain)
var dec Dupa
Decompress(comp, &dec)
require.Equal(t, dec, plain)
})
t.Run("very empty", func(t *testing.T) {
var (
plain *string
dec *string
)
plain = nil
comp := Compress(plain)
Decompress(comp, &dec)
require.Equal(t, dec, plain)
})
t.Run("decompress empty", func(t *testing.T) {
var (
dec string
)
Decompress([]byte{}, &dec)
require.Equal(t, dec, "")
})
}