Skip to content

Commit e13def1

Browse files
committed
more test cases
1 parent 4257d1a commit e13def1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

app/router/condition_geoip_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,33 @@ import (
1313
"v2ray.com/ext/sysio"
1414
)
1515

16+
func TestGeoIPMatcherContainer(t *testing.T) {
17+
container := &router.GeoIPMatcherContainer{}
18+
19+
m1, err := container.Add(&router.GeoIP{
20+
CountryCode: "CN",
21+
})
22+
common.Must(err)
23+
24+
m2, err := container.Add(&router.GeoIP{
25+
CountryCode: "US",
26+
})
27+
common.Must(err)
28+
29+
m3, err := container.Add(&router.GeoIP{
30+
CountryCode: "CN",
31+
})
32+
common.Must(err)
33+
34+
if m1 != m3 {
35+
t.Error("expect same matcher for same geoip, but not")
36+
}
37+
38+
if m1 == m2 {
39+
t.Error("expect different matcher for different geoip, but actually same")
40+
}
41+
}
42+
1643
func TestGeoIPMatcher(t *testing.T) {
1744
cidrList := router.CIDRList{
1845
{Ip: []byte{0, 0, 0, 0}, Prefix: 8},

0 commit comments

Comments
 (0)