mirror of https://bitbucket.org/ausocean/av.git
Tested decoding of named properties.
This commit is contained in:
parent
aa789f7e78
commit
f7c90e1093
|
@ -93,6 +93,7 @@ func TestNumbers(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// TestProperties tests encoding and decoding of properties.
|
// TestProperties tests encoding and decoding of properties.
|
||||||
func TestProperties(t *testing.T) {
|
func TestProperties(t *testing.T) {
|
||||||
var buf [1024]byte
|
var buf [1024]byte
|
||||||
|
@ -144,6 +145,7 @@ func TestProperties(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// TestObject tests encoding and decoding of objects.
|
// TestObject tests encoding and decoding of objects.
|
||||||
func TestObject(t *testing.T) {
|
func TestObject(t *testing.T) {
|
||||||
|
@ -186,7 +188,8 @@ func TestObject(t *testing.T) {
|
||||||
t.Errorf("Decode of object failed")
|
t.Errorf("Decode of object failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the object's property to a boolean.
|
// Change the object's property to a named boolean.
|
||||||
|
obj1.Properties[0].Name = "on"
|
||||||
obj1.Properties[0].Type = typeBoolean
|
obj1.Properties[0].Type = typeBoolean
|
||||||
obj1.Properties[0].Number = 1
|
obj1.Properties[0].Number = 1
|
||||||
|
|
||||||
|
@ -197,9 +200,9 @@ func TestObject(t *testing.T) {
|
||||||
t.Errorf("Encode of object failed")
|
t.Errorf("Encode of object failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-decode it.
|
// Decode it, this time with named set to true.
|
||||||
dec = buf[1:]
|
dec = buf[1:]
|
||||||
_, err = Decode(&dobj1, dec, false)
|
_, err = Decode(&dobj1, dec, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Decode of object failed with error: %v", err)
|
t.Errorf("Decode of object failed with error: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue