Splited encoding per object type, added public methods for serialization

This commit is contained in:
Jakub Nowakowski committed 2018-06-19 14:49:26 +02:00
1 parent 091f257cd5
commit e3cb617c60
12 files changed
+637 -365

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
package bson
import (
"reflect"
"testing"
"github.com/keep-network/paillier"
)
func TestCypherBsonSerialization(t *testing.T) {
cypher := &paillier.Cypher{
C: b(5),
}
serialized, err := SerializeCypher(cypher)
if err != nil {
t.Fatal(err)
}
deserialized, err := DeserializeCypher(serialized)
if err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(cypher, deserialized) {
t.Errorf(
"Unexpected serialization result\nActual: %v\nExpected: %v\n",
deserialized,
cypher,
)
}
}