From d675bb92df73edc4348f88a67f2a545167ec47d7 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 19 Nov 2018 11:18:20 +0100 Subject: [PATCH] update benchmark for address --- common/net/address_test.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/net/address_test.go b/common/net/address_test.go index 567ff506c..b3ed49497 100644 --- a/common/net/address_test.go +++ b/common/net/address_test.go @@ -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") + } } }