mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-22 08:25:38 +00:00
Vincent Batts
455edf6d21
For the most part, all the keywords for a standard mtree spec now have a function to produce the contents for a creator. These are used in the "walk" function, and will be used next in the "check" logic. This is still a WIP, as the DirectoryHierarchy produced from the current Walk() is not all-together a valid document. Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
30 lines
518 B
Go
30 lines
518 B
Go
package mtree
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
var (
|
|
checkFile = "./testdata/source.mtree"
|
|
checkSum uint32 = 1048442895
|
|
checkSize = 9110
|
|
)
|
|
|
|
func TestCksum(t *testing.T) {
|
|
fh, err := os.Open(checkFile)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer fh.Close()
|
|
sum, i, err := cksum(fh)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if i != checkSize {
|
|
t.Errorf("%q: expected size %d, got %d", checkFile, checkSize, i)
|
|
}
|
|
if sum != checkSum {
|
|
t.Errorf("%q: expected sum %d, got %d", checkFile, checkSum, sum)
|
|
}
|
|
}
|