core: reserve attributes range for experimantal purposes

This commit is contained in:
Anna Shaleva 2020-10-15 13:06:22 +03:00
parent 368ff820b3
commit 09b8b8de73
7 changed files with 107 additions and 7 deletions

View file

@ -36,6 +36,29 @@ func TestAttribute_EncodeBinary(t *testing.T) {
}
testserdes.EncodeDecodeBinary(t, attr, new(Attribute))
})
t.Run("Reserved", func(t *testing.T) {
getReservedAttribute := func(t AttrType) *Attribute {
return &Attribute{
Type: t,
Value: &Reserved{
Value: []byte{1, 2, 3, 4, 5},
},
}
}
t.Run("lower bound", func(t *testing.T) {
testserdes.EncodeDecodeBinary(t, getReservedAttribute(ReservedLowerBound+2), new(Attribute))
})
t.Run("upper bound", func(t *testing.T) {
testserdes.EncodeDecodeBinary(t, getReservedAttribute(ReservedUpperBound), new(Attribute))
})
t.Run("inside bounds", func(t *testing.T) {
testserdes.EncodeDecodeBinary(t, getReservedAttribute(ReservedLowerBound+5), new(Attribute))
})
t.Run("not reserved", func(t *testing.T) {
_, err := testserdes.EncodeBinary(getReservedAttribute(ReservedLowerBound - 1))
require.Error(t, err)
})
})
}
func TestAttribute_MarshalJSON(t *testing.T) {