Files
RemLink/internal/platform/windows/netinfo/prefixes_test.go
T
qsc20001102 142e5dc7d6
ci / Go checks (ubuntu-latest) (push) Has been cancelled
ci / Go checks (windows-latest) (push) Has been cancelled
初版功能完成
2026-08-29 13:12:17 +08:00

24 lines
573 B
Go

package netinfo
import (
"net/netip"
"testing"
)
func TestPrefixesOverlap(t *testing.T) {
for _, test := range []struct {
left, right string
want bool
}{
{"192.168.0.0/16", "192.168.13.0/24", true},
{"192.168.13.0/24", "192.168.13.10/32", true},
{"10.88.0.0/16", "10.89.0.0/16", false},
{"0.0.0.0/0", "10.88.0.0/16", true},
} {
got := PrefixesOverlap(netip.MustParsePrefix(test.left), netip.MustParsePrefix(test.right))
if got != test.want {
t.Errorf("PrefixesOverlap(%s, %s) = %v, want %v", test.left, test.right, got, test.want)
}
}
}