This repository has been archived by the owner on Aug 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpbo_test.go
97 lines (74 loc) · 1.6 KB
/
pbo_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
package pbo
import (
"path/filepath"
"testing"
)
const testPath = "test/"
func TestPBOWriteProduct(t *testing.T) {
pbo := New()
if err := pbo.WriteProduct(ProductEntry{
EntryName: "testPbo",
ProductName: "prefix",
ProductVersion: "",
}); err != nil {
t.Fatal(err.Error())
}
}
func TestPBOWriteHeader(t *testing.T) {
pbo := New()
if err := pbo.WriteHeader(HeaderEntry{
FileName: "config.cpp",
PackingMethod: 0x0,
OriginalSize: 24,
Reserved: 0,
TimeStamp: 0,
DataSize: 24,
}); err != nil {
t.Fatal(err.Error())
}
}
func TestPBOSave(t *testing.T) {
pbo := New()
path, _ := filepath.Abs(testPath)
pbo.From = path + "/testPbo"
pbo.To = path + "/test.pbo"
pbo.Prefix = "testPbo"
if err := pbo.Generate(); err != nil {
t.Fatal(err.Error())
}
if err := pbo.Save(); err != nil {
t.Fatal(err.Error())
}
}
func TestPBOSaveTo(t *testing.T) {
pbo := New()
path, _ := filepath.Abs(testPath)
pbo.From = path + "/testPbo"
pbo.Prefix = "testPbo"
if err := pbo.Generate(); err != nil {
t.Fatal(err.Error())
}
if err := pbo.SaveTo(path + "/test.pbo"); err != nil {
t.Fatal(err.Error())
}
}
func TestPBOGenerate(t *testing.T) {
pbo := New()
path, _ := filepath.Abs(testPath)
pbo.From = path + "/testPbo"
pbo.Prefix = "testPbo"
if err := pbo.Generate(); err != nil {
t.Fatal(err.Error())
}
}
func TestGetFiles(t *testing.T) {
pbo := New()
path, _ := filepath.Abs(testPath)
pbo.From = path + "/testPbo"
files := pbo.GetFiles()
if len(files) <= 0 {
t.Fatal("there have to be more than 0 files")
}
}
func TestPBOGetChecksum(t *testing.T) {
}