From e4e6ed2efa2743cc02c9b352ae75b3ffd5c983f1 Mon Sep 17 00:00:00 2001 From: shirou Date: Sun, 3 Jul 2022 02:44:35 +0000 Subject: [PATCH] fix(net,linux): fix BigEndian test --- net/net_linux_test.go | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/net/net_linux_test.go b/net/net_linux_test.go index bec091c..05ff023 100644 --- a/net/net_linux_test.go +++ b/net/net_linux_test.go @@ -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, }, @@ -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