so mamy things...

This commit is contained in:
didier amyot committed 2015-07-05 17:17:01 -04:00
1 parent f7a8d416c1
commit 78d50d9a6d
24 files changed
+516 -173

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
package doormen
import (
"encoding/json"
"gopkg.in/mgo.v2/bson"
"reflect"
"testing"
)
func TestJsonEncoding(t *testing.T) {
dmd := QuickNewDoormanDefinition("test json", "1/4", "3/4")
data, err := json.Marshal(dmd)
if err != nil {
t.Error(err)
}
dmd2 := new(DoormanDefinition)
if err = json.Unmarshal(data, dmd2); err != nil {
t.Error(err)
}
if !reflect.DeepEqual(dmd2, dmd) {
t.Error()
}
}
func TestBsonEncoding(t *testing.T) {
dmd := QuickNewDoormanDefinition("test bson", "1/4", "3/4")
data, err := bson.Marshal(dmd)
if err != nil {
t.Error(err)
}
dmd2 := new(DoormanDefinition)
if err = bson.Unmarshal(data, dmd2); err != nil {
t.Error(err)
}
if !reflect.DeepEqual(dmd2, dmd) {
t.Error()
}
}