diff options
author | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-02-15 11:53:56 +0900 |
---|---|---|
committer | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-02-15 11:53:56 +0900 |
commit | 4e1edd39c2333af217d8972ad8c1b7b0556c93cc (patch) | |
tree | 64c2b0d6e1aca786d9921e640111ccf1007da9dc /packet | |
parent | 9f6a0c501af7375a2c242869e249f72bc6ed5770 (diff) |
test: not rely on the type check auto conversion in assert.Equal
Diffstat (limited to 'packet')
-rw-r--r-- | packet/validate_test.go | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/packet/validate_test.go b/packet/validate_test.go index 7f5d93ec..effd9d89 100644 --- a/packet/validate_test.go +++ b/packet/validate_test.go @@ -155,8 +155,8 @@ func Test_Validate_duplicate_attribute(t *testing.T) { assert.Equal(false, res) assert.Error(err) e := err.(*MessageError) - assert.Equal(BGP_ERROR_UPDATE_MESSAGE_ERROR, e.TypeCode) - assert.Equal(BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST, e.SubTypeCode) + assert.Equal(uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR), e.TypeCode) + assert.Equal(uint8(BGP_ERROR_SUB_MALFORMED_ATTRIBUTE_LIST), e.SubTypeCode) assert.Nil(e.Data) } @@ -168,10 +168,10 @@ func Test_Validate_mandatory_missing(t *testing.T) { assert.Equal(false, res) assert.Error(err) e := err.(*MessageError) - assert.Equal(BGP_ERROR_UPDATE_MESSAGE_ERROR, e.TypeCode) - assert.Equal(BGP_ERROR_SUB_MISSING_WELL_KNOWN_ATTRIBUTE, e.SubTypeCode) + assert.Equal(uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR), e.TypeCode) + assert.Equal(uint8(BGP_ERROR_SUB_MISSING_WELL_KNOWN_ATTRIBUTE), e.SubTypeCode) missing, _ := binary.Uvarint(e.Data) - assert.Equal(1, missing) + assert.Equal(uint8(1), missing) } func Test_Validate_mandatory_missing_nocheck(t *testing.T) { @@ -198,8 +198,8 @@ func Test_Validate_invalid_origin(t *testing.T) { assert.Equal(false, res) assert.Error(err) e := err.(*MessageError) - assert.Equal(BGP_ERROR_UPDATE_MESSAGE_ERROR, e.TypeCode) - assert.Equal(BGP_ERROR_SUB_INVALID_ORIGIN_ATTRIBUTE, e.SubTypeCode) + assert.Equal(uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR), e.TypeCode) + assert.Equal(uint8(BGP_ERROR_SUB_INVALID_ORIGIN_ATTRIBUTE), e.SubTypeCode) assert.Equal(originBytes, e.Data) } @@ -219,8 +219,8 @@ func Test_Validate_invalid_nexthop_zero(t *testing.T) { assert.Equal(false, res) assert.Error(err) e := err.(*MessageError) - assert.Equal(BGP_ERROR_UPDATE_MESSAGE_ERROR, e.TypeCode) - assert.Equal(BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE, e.SubTypeCode) + assert.Equal(uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR), e.TypeCode) + assert.Equal(uint8(BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE), e.SubTypeCode) assert.Equal(nexthopBytes, e.Data) } @@ -240,8 +240,8 @@ func Test_Validate_invalid_nexthop_lo(t *testing.T) { assert.Equal(false, res) assert.Error(err) e := err.(*MessageError) - assert.Equal(BGP_ERROR_UPDATE_MESSAGE_ERROR, e.TypeCode) - assert.Equal(BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE, e.SubTypeCode) + assert.Equal(uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR), e.TypeCode) + assert.Equal(uint8(BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE), e.SubTypeCode) assert.Equal(nexthopBytes, e.Data) } @@ -261,8 +261,8 @@ func Test_Validate_invalid_nexthop_de(t *testing.T) { assert.Equal(false, res) assert.Error(err) e := err.(*MessageError) - assert.Equal(BGP_ERROR_UPDATE_MESSAGE_ERROR, e.TypeCode) - assert.Equal(BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE, e.SubTypeCode) + assert.Equal(uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR), e.TypeCode) + assert.Equal(uint8(BGP_ERROR_SUB_INVALID_NEXT_HOP_ATTRIBUTE), e.SubTypeCode) assert.Equal(nexthopBytes, e.Data) } @@ -281,7 +281,7 @@ func Test_Validate_unrecognized_well_known(t *testing.T) { assert.Equal(false, res) assert.Error(err) e := err.(*MessageError) - assert.Equal(BGP_ERROR_UPDATE_MESSAGE_ERROR, e.TypeCode) - assert.Equal(BGP_ERROR_SUB_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE, e.SubTypeCode) + assert.Equal(uint8(BGP_ERROR_UPDATE_MESSAGE_ERROR), e.TypeCode) + assert.Equal(uint8(BGP_ERROR_SUB_UNRECOGNIZED_WELL_KNOWN_ATTRIBUTE), e.SubTypeCode) assert.Equal(unknownBytes, e.Data) } |