aboutsummaryrefslogtreecommitdiff
path: root/hash/hash_test.go
blob: 66eca9534f79eedb241722573b04828ead9df15f (plain)
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
package hash

import (
	"encoding/binary"
	"os"
	"testing"
)

func TestOpen(t *testing.T) {
	fd, err := os.Open("testdata/aliases.db")
	if err != nil {
		t.Fatal(err)
	}
	defer fd.Close()
	var hdr HashHdr
	if err := binary.Read(fd, binary.BigEndian, &hdr); err != nil {
		t.Fatal(err)
	}
	if hdr.Magic != magic {
		t.Errorf("got %x, want %x", hdr.Magic, magic)
	}
	if hdr.Version != version {
		t.Errorf("got %x, want %x", hdr.Version, version)
	}
	t.Logf("%+v", hdr)
}