You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
482 B
28 lines
482 B
package nets |
|
|
|
import "testing" |
|
|
|
func TestIpConvert(t *testing.T) { |
|
ip := "192.168.1.110" |
|
// ip := "255.255.255.255" |
|
i64, err := Ip2i64(ip) |
|
if err != nil { |
|
t.Error(err) |
|
} |
|
ip2 := I642Ip(int64(int32(i64))) |
|
if ip2 != ip { |
|
t.Error("ip parse error") |
|
} |
|
} |
|
|
|
func TestAddressConvert(t *testing.T) { |
|
addr := "192.168.1.110:8080" |
|
i64, err := Address2i64(addr) |
|
if err != nil { |
|
t.Error(err) |
|
} |
|
addr2 := I642Address(i64) |
|
if addr2 != addr { |
|
t.Error("address parse error") |
|
} |
|
}
|
|
|