(t *testing.T)
| 41 | } |
| 42 | |
| 43 | func TestGetRandomIPv6Subnet(t *testing.T) { |
| 44 | for i := 0; i < 1000; i++ { |
| 45 | t.Run(fmt.Sprintf("GetRandomIPv6Subnet %d", i), func(t *testing.T) { |
| 46 | sub, err := getRandomIPv6Subnet() |
| 47 | if err != nil { |
| 48 | t.Errorf("GetRandomIPv6Subnet() error should be nil: %v", err) |
| 49 | return |
| 50 | } |
| 51 | if sub.IP.To4() != nil { |
| 52 | t.Errorf("ip %s is not an ipv6 address", sub.IP) |
| 53 | } |
| 54 | if sub.IP[0] != 0xfd { |
| 55 | t.Errorf("ipv6 %s does not start with fd", sub.IP) |
| 56 | } |
| 57 | ones, bytes := sub.Mask.Size() |
| 58 | if ones != 64 || bytes != 128 { |
| 59 | t.Errorf("wrong network mask %v, it should be /64", sub.Mask) |
| 60 | } |
| 61 | }) |
| 62 | } |
| 63 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…