diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2017-06-25 10:20:26 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2017-06-25 17:44:49 +0200 |
commit | fb14fb157c0835d61cbc7f8425d89b941bd0ab16 (patch) | |
tree | eb8a1d6e00cd4024f2f088326853be2174e7869d /objects/object_test.go | |
parent | 82dd9f540be12c4c93679d2a60c4d1950e57eec8 (diff) | |
download | petrific-fb14fb157c0835d61cbc7f8425d89b941bd0ab16.tar.gz petrific-fb14fb157c0835d61cbc7f8425d89b941bd0ab16.tar.bz2 petrific-fb14fb157c0835d61cbc7f8425d89b941bd0ab16.zip |
Implement object IDs
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") + } +} |