From fb14fb157c0835d61cbc7f8425d89b941bd0ab16 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 25 Jun 2017 10:20:26 +0200 Subject: Implement object IDs --- objects/object_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'objects/object_test.go') diff --git a/objects/object_test.go b/objects/object_test.go index c596b39..54b33db 100644 --- a/objects/object_test.go +++ b/objects/object_test.go @@ -86,3 +86,21 @@ func TestSerialize(t *testing.T) { t.Errorf("Unexpected serialization result: %v", b) } } + +func TestSerializeAndId(t *testing.T) { + o := Object{ + Type: OTBlob, + Payload: []byte("foo bar\nbaz"), + } + + buf := new(bytes.Buffer) + id, err := o.SerializeAndId(buf, OIdAlgoDefault) + + if err != nil { + t.Fatalf("Serialization failed:%s", err) + } + + if !id.VerifyObject(o) { + t.Errorf("Verification failed") + } +} -- cgit v1.2.3-54-g00ecf