fix(net,linux): fix BigEndian test

This commit is contained in:
shirou 2022-07-03 02:44:35 +00:00
parent 8ae3affce0
commit e4e6ed2efa
1 changed files with 19 additions and 8 deletions

View File

@ -137,14 +137,6 @@ func TestDecodeAddress(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
addr := map[string]AddrTest{ addr := map[string]AddrTest{
"0500000A:0016": {
IP: "10.0.0.5",
Port: 22,
},
"0100007F:D1C2": {
IP: "127.0.0.1",
Port: 53698,
},
"11111:0035": { "11111:0035": {
Error: true, Error: true,
}, },
@ -159,6 +151,25 @@ func TestDecodeAddress(t *testing.T) {
Error: true, Error: true,
}, },
} }
if IsLittleEndian() {
addr["0500000A:0016"] = AddrTest{
IP: "10.0.0.5",
Port: 22,
}
addr["0100007F:D1C2"] = AddrTest{
IP: "127.0.0.1",
Port: 53698,
}
} else {
addr["0A000005:0016"] = AddrTest{
IP: "10.0.0.5",
Port: 22,
}
addr["7F000001:D1C2"] = AddrTest{
IP: "127.0.0.1",
Port: 53698,
}
}
for src, dst := range addr { for src, dst := range addr {
family := syscall.AF_INET family := syscall.AF_INET