Skip to content

Commit

Permalink
fix(net,linux): fix BigEndian test
Browse files Browse the repository at this point in the history
  • Loading branch information
shirou committed Jul 3, 2022
1 parent 8ae3aff commit e4e6ed2
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions net/net_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,6 @@ func TestDecodeAddress(t *testing.T) {
assert := assert.New(t)

addr := map[string]AddrTest{
"0500000A:0016": {
IP: "10.0.0.5",
Port: 22,
},
"0100007F:D1C2": {
IP: "127.0.0.1",
Port: 53698,
},
"11111:0035": {
Error: true,
},
Expand All @@ -159,6 +151,25 @@ func TestDecodeAddress(t *testing.T) {
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 {
family := syscall.AF_INET
Expand Down

0 comments on commit e4e6ed2

Please sign in to comment.