Skip to content

Commit

Permalink
more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Nov 4, 2018
1 parent 4257d1a commit e13def1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions app/router/condition_geoip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ import (
"v2ray.com/ext/sysio"
)

func TestGeoIPMatcherContainer(t *testing.T) {
container := &router.GeoIPMatcherContainer{}

m1, err := container.Add(&router.GeoIP{
CountryCode: "CN",
})
common.Must(err)

m2, err := container.Add(&router.GeoIP{
CountryCode: "US",
})
common.Must(err)

m3, err := container.Add(&router.GeoIP{
CountryCode: "CN",
})
common.Must(err)

if m1 != m3 {
t.Error("expect same matcher for same geoip, but not")
}

if m1 == m2 {
t.Error("expect different matcher for different geoip, but actually same")
}
}

func TestGeoIPMatcher(t *testing.T) {
cidrList := router.CIDRList{
{Ip: []byte{0, 0, 0, 0}, Prefix: 8},
Expand Down

0 comments on commit e13def1

Please sign in to comment.