zlib-go/src/zfile/exp/exp_test.go
2023-09-15 21:32:20 +08:00

38 lines
737 B
Go

package exp
import (
"testing"
"zlib/src/zfile"
"zlib/src/zfile/core"
"zlib/src/zlog"
)
func TestEncoder(t *testing.T) {
path := zfile.GetRealPath("zfile/file/main.cpp2.obj")
ar := core.NewFileArchive(path)
var coff *FCoff64
if coff.CheckValid(ar) {
coff = &FCoff64{}
coff.Serialize(ar)
hdr1 := coff.Header
hdr2 := coff.Header
ar.SetSwapBytes(true)
ar.SwapStructBytes(&hdr1)
ar.SwapStructBytes(&hdr2)
zlog.Infof("%s", hdr1)
zlog.Infof("%s", hdr2)
}
}
func TestFile(t *testing.T) {
path := zfile.GetRealPath("zfile/file/SimpleSection")
ar := core.NewFileArchive(path)
var exp FPackageExpansion
var elf *FElf64
if elf.CheckValid(ar) {
elf = &FElf64{}
elf.Serialize(ar)
exp.ExpansionElf64(elf)
}
}