2015-10-04 17:18:32 -04:00
|
|
|
package ipamutils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-02-26 17:58:11 -05:00
|
|
|
_ "github.com/docker/libnetwork/testutils"
|
2015-10-04 17:18:32 -04:00
|
|
|
)
|
|
|
|
|
2016-04-04 09:50:26 -04:00
|
|
|
func init() {
|
|
|
|
InitNetworks()
|
|
|
|
}
|
|
|
|
|
2015-10-04 17:18:32 -04:00
|
|
|
func TestGranularPredefined(t *testing.T) {
|
|
|
|
for _, nw := range PredefinedGranularNetworks {
|
|
|
|
if ones, bits := nw.Mask.Size(); bits != 32 || ones != 24 {
|
|
|
|
t.Fatalf("Unexpected size for network in granular list: %v", nw)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, nw := range PredefinedBroadNetworks {
|
|
|
|
if ones, bits := nw.Mask.Size(); bits != 32 || (ones != 20 && ones != 16) {
|
|
|
|
t.Fatalf("Unexpected size for network in broad list: %v", nw)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|