diff options
Diffstat (limited to 'objects/object_test.go')
-rw-r--r-- | objects/object_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
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") + } +} |