From 932a267a41af3db4f9a1d84637f298b64cdcfa23 Mon Sep 17 00:00:00 2001 From: krawthekrow Date: Sun, 15 Apr 2018 23:26:51 -0400 Subject: [PATCH] add test for zascii SenderAddress in DecodeNotice, use different ip address to test endianness --- notice_test.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/notice_test.go b/notice_test.go index 29f574e..1c0b9c7 100644 --- a/notice_test.go +++ b/notice_test.go @@ -120,8 +120,16 @@ func TestDecodeNotice(t *testing.T) { } // Value in sender address takes precedence over UID value. - raw.HeaderFields[17] = []byte("Z\x08\x08\x08\x08") - expected.SenderAddress = net.ParseIP("8.8.8.8").To4() + raw.HeaderFields[17] = []byte("Z\xDE\xAD\xBE\xEF") + expected.SenderAddress = net.ParseIP("222.173.190.239").To4() + if notice, err := DecodeRawNotice(raw); err != nil { + t.Errorf("DecodeRawNotice(%v) failed: %v", raw, err) + } else { + expectNoticesEqual(t, notice, expected) + } + + raw.HeaderFields[17] = []byte("0xDEADBEEF") + expected.SenderAddress = net.ParseIP("222.173.190.239").To4() if notice, err := DecodeRawNotice(raw); err != nil { t.Errorf("DecodeRawNotice(%v) failed: %v", raw, err) } else {