Skip to content

Commit

Permalink
add test for zascii SenderAddress in DecodeNotice, use different ip a…
Browse files Browse the repository at this point in the history
…ddress to test endianness
  • Loading branch information
krawthekrow authored and davidben committed Apr 16, 2018
1 parent c24380c commit 932a267
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions notice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 932a267

Please sign in to comment.