summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
authorVincent Bernat <vincent@bernat.im>2017-12-16 13:43:52 +0100
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-12-17 00:22:00 +0900
commita44dd5d4116b7b42b5e97b268d30fc7904c25b77 (patch)
treeec434b7a0541afde35ec00432c81fa2bf898cb35 /packet
parent1227aceb31af1bdc817ee4d89a72a7a7db874347 (diff)
packet/bgp: use strconv.FormatInt() instead of strconv.Itoa() in tests
Itoa() takes an int which will only be 32-bit on i386 and similar architectures. In tests, some constants are too big. Therefore, switch all uses of strconv.Itoa() to strconv.FormatInt(). Without this change, we get: ``` src/github.com/osrg/gobgp/packet/bgp/bgp_test.go:1123:41: constant 2864434397 overflows int ```
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp/bgp_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/packet/bgp/bgp_test.go b/packet/bgp/bgp_test.go
index 5f8319bf..7f84b8d8 100644
--- a/packet/bgp/bgp_test.go
+++ b/packet/bgp/bgp_test.go
@@ -1140,7 +1140,7 @@ func Test_ParseEthernetSegmentIdentifier(t *testing.T) {
}, esi)
// ESI_LACP
- args = []string{"lacp", "aa:bb:cc:dd:ee:ff", strconv.Itoa(0x1122)} // lower case
+ args = []string{"lacp", "aa:bb:cc:dd:ee:ff", strconv.FormatInt(0x1122, 10)} // lower case
esi, err = ParseEthernetSegmentIdentifier(args)
assert.Nil(err)
assert.Equal(EthernetSegmentIdentifier{
@@ -1149,7 +1149,7 @@ func Test_ParseEthernetSegmentIdentifier(t *testing.T) {
}, esi)
// ESI_MSTP
- args = []string{"esi_mstp", "aa:bb:cc:dd:ee:ff", strconv.Itoa(0x1122)} // omit "ESI_" + lower case
+ args = []string{"esi_mstp", "aa:bb:cc:dd:ee:ff", strconv.FormatInt(0x1122, 10)} // omit "ESI_" + lower case
esi, err = ParseEthernetSegmentIdentifier(args)
assert.Nil(err)
assert.Equal(EthernetSegmentIdentifier{
@@ -1158,7 +1158,7 @@ func Test_ParseEthernetSegmentIdentifier(t *testing.T) {
}, esi)
// ESI_MAC
- args = []string{"ESI_MAC", "aa:bb:cc:dd:ee:ff", strconv.Itoa(0x112233)}
+ args = []string{"ESI_MAC", "aa:bb:cc:dd:ee:ff", strconv.FormatInt(0x112233, 10)}
esi, err = ParseEthernetSegmentIdentifier(args)
assert.Nil(err)
assert.Equal(EthernetSegmentIdentifier{
@@ -1167,7 +1167,7 @@ func Test_ParseEthernetSegmentIdentifier(t *testing.T) {
}, esi)
// ESI_ROUTERID
- args = []string{"ESI_ROUTERID", "1.1.1.1", strconv.Itoa(0x11223344)}
+ args = []string{"ESI_ROUTERID", "1.1.1.1", strconv.FormatInt(0x11223344, 10)}
esi, err = ParseEthernetSegmentIdentifier(args)
assert.Nil(err)
assert.Equal(EthernetSegmentIdentifier{
@@ -1176,7 +1176,7 @@ func Test_ParseEthernetSegmentIdentifier(t *testing.T) {
}, esi)
// ESI_AS
- args = []string{"ESI_AS", strconv.Itoa(0xaabbccdd), strconv.Itoa(0x11223344)}
+ args = []string{"ESI_AS", strconv.FormatInt(0xaabbccdd, 10), strconv.FormatInt(0x11223344, 10)}
esi, err = ParseEthernetSegmentIdentifier(args)
assert.Nil(err)
assert.Equal(EthernetSegmentIdentifier{