From 1f1942ec0a4e55b3488a1771475994253bfe9b9e Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 22 Nov 2021 13:48:19 +0100 Subject: Move --- hash/hash_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 hash/hash_test.go (limited to 'hash/hash_test.go') diff --git a/hash/hash_test.go b/hash/hash_test.go new file mode 100644 index 0000000..da3a4a6 --- /dev/null +++ b/hash/hash_test.go @@ -0,0 +1,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) +} -- cgit v1.2.3