mirror of
https://github.com/siemens-mobile-hacks/siepatcher.git
synced 2026-11-25 19:37:15 +00:00
35 lines
695 B
Go
35 lines
695 B
Go
package patchreader
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func testFileFullPath(baseName string) string {
|
|
return filepath.Join("..", "..", "testdata", baseName)
|
|
}
|
|
|
|
func TestLoadPlainPatch(t *testing.T) {
|
|
testCases := []struct {
|
|
fileName string
|
|
NumChunks int
|
|
wantError bool
|
|
}{
|
|
{
|
|
fileName: "plainbody.vkp",
|
|
NumChunks: 1,
|
|
wantError: false,
|
|
},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
p, err := FromFile(testFileFullPath(tc.fileName))
|
|
if (err != nil) != tc.wantError {
|
|
t.Fatalf("Test failure: %t (%v), want %t", err != nil, err, tc.wantError)
|
|
}
|
|
if p.NumChunks() != tc.NumChunks {
|
|
t.Fatalf("Got %d chunks in patch, want %d", p.NumChunks(), tc.NumChunks)
|
|
}
|
|
}
|
|
|
|
}
|