-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpack_test.go
43 lines (39 loc) · 1.35 KB
/
pack_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
package main
import (
"os"
"testing"
)
func TestPackCC1(t *testing.T) {
if f, err := os.OpenFile("./test/cc1.mix", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644); err != nil {
t.Fatal(err)
} else if files, err := listFilesToPack("./test/files", true, gameCC1); err != nil {
t.Fatal(err)
} else if err := pack(f, files, gameCC1, 0, nil); err != nil {
t.Fatal(err)
} else if err := f.Close(); err != nil {
t.Fatal(err)
}
}
func TestPackRA1(t *testing.T) {
keySource := []byte{
0xca, 0xd0, 0xb0, 0x1b, 0xfe, 0x3f, 0x3f, 0xb6,
0xca, 0xc0, 0xbd, 0x8f, 0x40, 0xf0, 0xee, 0x85,
0x6e, 0xe1, 0xda, 0x7a, 0xef, 0xb4, 0xd4, 0xbb,
0x6a, 0xd8, 0x4b, 0x84, 0x26, 0x99, 0x6f, 0xfd,
0x65, 0x97, 0xf2, 0x5f, 0xa4, 0x46, 0xdb, 0x47,
0x88, 0x63, 0x4f, 0x2c, 0x14, 0x0b, 0x3c, 0xce,
0xaa, 0xc4, 0x5c, 0xe4, 0x15, 0x86, 0x26, 0x5c,
0x52, 0x3a, 0x80, 0xf8, 0xbe, 0x45, 0x40, 0x6a,
0x66, 0xb4, 0xc5, 0xf6, 0xd0, 0x12, 0xe0, 0x43,
0x44, 0x65, 0xc6, 0xe3, 0x9e, 0xf9, 0x43, 0x35,
}
if f, err := os.OpenFile("./test/ra1.mix", os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644); err != nil {
t.Fatal(err)
} else if files, err := listFilesToPack("./test/files", true, gameRA1); err != nil {
t.Fatal(err)
} else if err := pack(f, files, gameRA1, flagChecksum|flagEncrypted, keySource); err != nil {
t.Fatal(err)
} else if err := f.Close(); err != nil {
t.Fatal(err)
}
}