Debian Codegraph @

lzip_test.go

raw symbols SCIP
1 // SPDX-FileCopyrightText: 2024 Shun Sakai
2 //
3 // SPDX-License-Identifier: Apache-2.0 OR MIT
4
5 package lzip_test
6
7 import (
8 "slices"
9 "testing"
10
11 "github.com/sorairolake/lzip-go"
12 )
13
14 func TestHeaderSize(t *testing.T) {
15 t.Parallel()
16
17 if size := lzip.HeaderSize; size != 6 {
18 t.Errorf("expected header size `%v`, got `%v`", 6, size)
19 }
20 }
21
22 func TestTrailerSize(t *testing.T) {
23 t.Parallel()
24
25 if size := lzip.TrailerSize; size != 20 {
26 t.Errorf("expected trailer size `%v`, got `%v`", 20, size)
27 }
28 }
29
30 func TestMagic(t *testing.T) {
31 t.Parallel()
32
33 expected := [lzip.MagicSize]byte{0x4C, 0x5A, 0x49, 0x50}
34 if !slices.Equal([]byte(lzip.Magic), expected[:]) {
35 t.Error("unexpected magic number")
36 }
37 }
38
39 func TestMagicSize(t *testing.T) {
40 t.Parallel()
41
42 if size := lzip.MagicSize; size != 4 {
43 t.Errorf("expected magic number size `%v`, got `%v`", 4, size)
44 }
45 }
46
47 func TestVersion(t *testing.T) {
48 t.Parallel()
49
50 if v0 := lzip.Version0; v0 != 0 {
51 t.Errorf("expected version number `%v`, got `%v`", 0, v0)
52 }
53
54 if v1 := lzip.Version1; v1 != 1 {
55 t.Errorf("expected version number `%v`, got `%v`", 1, v1)
56 }
57 }
58
59 func TestMinDictSize(t *testing.T) {
60 t.Parallel()
61
62 const expected = 1 << 12
63
64 if size := lzip.MinDictSize; size != expected {
65 t.Errorf("expected minimum dictionary size `%v`, got `%v`", expected, size)
66 }
67 }
68
69 func TestMaxDictSize(t *testing.T) {
70 t.Parallel()
71
72 const expected = 1 << 29
73
74 if size := lzip.MaxDictSize; size != expected {
75 t.Errorf("expected maximum dictionary size `%v`, got `%v`", expected, size)
76 }
77 }
78
79 func TestDefaultDictSize(t *testing.T) {
80 t.Parallel()
81
82 const expected = 1 << 23
83
84 if size := lzip.DefaultDictSize; size != expected {
85 t.Errorf("expected default dictionary size `%v`, got `%v`", expected, size)
86 }
87 }
88
89 func TestMaxMemberSize(t *testing.T) {
90 t.Parallel()
91
92 const expected = 1 << 51
93
94 if size := lzip.MaxMemberSize; size != expected {
95 t.Errorf("expected maximum member size `%v`, got `%v`", expected, size)
96 }
97 }