1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 15:36:41 -05:00

update benchmark for address

This commit is contained in:
Darien Raymond 2018-11-19 11:18:20 +01:00
parent 91227581e5
commit d675bb92df
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -104,18 +104,27 @@ func TestIPOrDomain(t *testing.T) {
func BenchmarkParseAddressIPv4(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = ParseAddress("8.8.8.8")
addr := ParseAddress("8.8.8.8")
if addr.Family() != AddressFamilyIPv4 {
panic("not ipv4")
}
}
}
func BenchmarkParseAddressIPv6(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = ParseAddress("2001:4860:0:2001::68")
addr := ParseAddress("2001:4860:0:2001::68")
if addr.Family() != AddressFamilyIPv6 {
panic("not ipv6")
}
}
}
func BenchmarkParseAddressDomain(b *testing.B) {
for i := 0; i < b.N; i++ {
_ = ParseAddress("v2ray.com")
addr := ParseAddress("v2ray.com")
if addr.Family() != AddressFamilyDomain {
panic("not domain")
}
}
}