mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
29 lines
673 B
Go
29 lines
673 B
Go
// Copyright (c) 2013-2016 The btcsuite developers
|
|
// Use of this source code is governed by an ISC
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package appmessage
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
)
|
|
|
|
// TestNetAddress tests the NetAddress API.
|
|
func TestNetAddress(t *testing.T) {
|
|
ip := net.ParseIP("127.0.0.1")
|
|
port := 16111
|
|
|
|
// Test NewNetAddress.
|
|
na := NewNetAddress(&net.TCPAddr{IP: ip, Port: port})
|
|
|
|
// Ensure we get the same ip, port, and services back out.
|
|
if !na.IP.Equal(ip) {
|
|
t.Errorf("NetNetAddress: wrong ip - got %v, want %v", na.IP, ip)
|
|
}
|
|
if na.Port != uint16(port) {
|
|
t.Errorf("NetNetAddress: wrong port - got %v, want %v", na.Port,
|
|
port)
|
|
}
|
|
}
|