mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-13 04:54:48 +08:00
f63dfaf4b5
* add egress range check with netmaker network address * add egerssrange check for delete egressGW and extClientGW * remove egress range check for delete
33 lines
636 B
Go
33 lines
636 B
Go
package logic
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestContainsCIDR(t *testing.T) {
|
|
|
|
b := ContainsCIDR("10.1.1.2/32", "10.1.1.0/24")
|
|
if !b {
|
|
t.Errorf("expected true, returned %v", b)
|
|
}
|
|
|
|
b = ContainsCIDR("10.1.1.2/32", "10.5.1.0/24")
|
|
if b {
|
|
t.Errorf("expected false, returned %v", b)
|
|
}
|
|
|
|
b = ContainsCIDR("fd52:65f5:d685:d11d::1/64", "fd52:65f5:d685:d11d::/64")
|
|
if !b {
|
|
t.Errorf("expected true, returned %v", b)
|
|
}
|
|
|
|
b1 := ContainsCIDR("fd10:10::/64", "fd10::/16")
|
|
if !b1 {
|
|
t.Errorf("expected true, returned %v", b1)
|
|
}
|
|
|
|
b1 = ContainsCIDR("fd10:10::/64", "fd10::/64")
|
|
if b1 {
|
|
t.Errorf("expected false, returned %v", b1)
|
|
}
|
|
}
|