mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-02 15:25:28 -05:00
simplify testing
This commit is contained in:
@@ -5,18 +5,19 @@ import (
|
||||
"testing"
|
||||
|
||||
. "github.com/v2ray/v2ray-core/common/net"
|
||||
v2testing "github.com/v2ray/v2ray-core/testing"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
)
|
||||
|
||||
func parseCIDR(str string) *net.IPNet {
|
||||
_, ipNet, err := net.ParseCIDR(str)
|
||||
assert.Error(err).IsNil()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return ipNet
|
||||
}
|
||||
|
||||
func TestIPNet(t *testing.T) {
|
||||
v2testing.Current(t)
|
||||
assert := assert.On(t)
|
||||
|
||||
ipNet := NewIPNet()
|
||||
ipNet.Add(parseCIDR(("0.0.0.0/8")))
|
||||
|
||||
Reference in New Issue
Block a user