-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlzfse_test.go
54 lines (49 loc) · 1.41 KB
/
lzfse_test.go
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
package lzfse
import (
"os"
"testing"
)
func TestDecodeBuffer(t *testing.T) {
wantBuf, err := os.ReadFile("test/dec.bin")
if err != nil {
t.Errorf("failed to read test file 'test/dec.bin': %v", err)
}
encBuff, err := os.ReadFile("test/enc.bin")
if err != nil {
t.Errorf("failed to read test file 'test/enc.bin': %v", err)
}
testDecodeBuffer(t, encBuff, wantBuf)
}
func TestEncodeBuffer(t *testing.T) {
wantBuf, err := os.ReadFile("test/enc.bin")
if err != nil {
t.Errorf("failed to read test file 'test/enc.bin': %v", err)
}
decBuff, err := os.ReadFile("test/dec.bin")
if err != nil {
t.Errorf("failed to read test file 'test/dec.bin': %v", err)
}
testEncodeBuffer(t, decBuff, wantBuf)
}
func TestDecodeLZVNBuffer(t *testing.T) {
wantBuf, err := os.ReadFile("test/lzvn_dec.bin")
if err != nil {
t.Errorf("failed to read test file 'test/lzvn_dec.bin': %v", err)
}
encBuff, err := os.ReadFile("test/lzvn_enc.bin")
if err != nil {
t.Errorf("failed to read test file 'test/lzvn_enc.bin': %v", err)
}
testDecodeLZVNBuffer(t, encBuff, wantBuf)
}
func TestEncodeLZVNBuffer(t *testing.T) {
wantBuf, err := os.ReadFile("test/lzvn_enc.bin")
if err != nil {
t.Errorf("failed to read test file 'test/lzvn_enc.bin': %v", err)
}
srcBuff, err := os.ReadFile("test/lzvn_dec.bin")
if err != nil {
t.Errorf("failed to read test file 'test/lzvn_dec.bin': %v", err)
}
testEncodeLZVNBuffer(t, srcBuff, wantBuf)
}