-
Notifications
You must be signed in to change notification settings - Fork 0
/
lzip_test.go
97 lines (71 loc) · 1.92 KB
/
lzip_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// SPDX-FileCopyrightText: 2024 Shun Sakai
//
// SPDX-License-Identifier: Apache-2.0 OR MIT
package lzip_test
import (
"slices"
"testing"
"github.com/sorairolake/lzip-go"
)
func TestHeaderSize(t *testing.T) {
t.Parallel()
if size := lzip.HeaderSize; size != 6 {
t.Errorf("expected header size `%v`, got `%v`", 6, size)
}
}
func TestTrailerSize(t *testing.T) {
t.Parallel()
if size := lzip.TrailerSize; size != 20 {
t.Errorf("expected trailer size `%v`, got `%v`", 20, size)
}
}
func TestMagic(t *testing.T) {
t.Parallel()
expected := [lzip.MagicSize]byte{0x4c, 0x5a, 0x49, 0x50}
if !slices.Equal([]byte(lzip.Magic), expected[:]) {
t.Error("unexpected magic number")
}
}
func TestMagicSize(t *testing.T) {
t.Parallel()
if size := lzip.MagicSize; size != 4 {
t.Errorf("expected magic number size `%v`, got `%v`", 4, size)
}
}
func TestVersion(t *testing.T) {
t.Parallel()
if v0 := lzip.Version0; v0 != 0 {
t.Errorf("expected version number `%v`, got `%v`", 0, v0)
}
if v1 := lzip.Version1; v1 != 1 {
t.Errorf("expected version number `%v`, got `%v`", 1, v1)
}
}
func TestMinDictSize(t *testing.T) {
t.Parallel()
const expected = 1 << 12
if size := lzip.MinDictSize; size != expected {
t.Errorf("expected minimum dictionary size `%v`, got `%v`", expected, size)
}
}
func TestMaxDictSize(t *testing.T) {
t.Parallel()
const expected = 1 << 29
if size := lzip.MaxDictSize; size != expected {
t.Errorf("expected maximum dictionary size `%v`, got `%v`", expected, size)
}
}
func TestDefaultDictSize(t *testing.T) {
t.Parallel()
const expected = 1 << 23
if size := lzip.DefaultDictSize; size != expected {
t.Errorf("expected default dictionary size `%v`, got `%v`", expected, size)
}
}
func TestMaxMemberSize(t *testing.T) {
t.Parallel()
const expected = 1 << 51
if size := lzip.MaxMemberSize; size != expected {
t.Errorf("expected maximum member size `%v`, got `%v`", expected, size)
}
}