Lines Matching refs:tt
45 for _, tt := range parseIPTests {
46 if out := ParseIP(tt.in); !reflect.DeepEqual(out, tt.out) {
47 t.Errorf("ParseIP(%q) = %v, want %v", tt.in, out, tt.out)
49 if tt.in == "" {
54 if err := out.UnmarshalText([]byte(tt.in)); !reflect.DeepEqual(out, tt.out) || (tt.out == nil) != (err != nil) {
55 t.Errorf("IP.UnmarshalText(%q) = %v, %v, want %v", tt.in, out, err, tt.out)
72 for _, tt := range parseIPTests {
73 if tt.out != nil {
74 addrs, err := LookupHost(tt.in)
75 if len(addrs) != 1 || addrs[0] != tt.in || err != nil {
76 t.Errorf("LookupHost(%q) = %v, %v, want %v, nil", tt.in, addrs, err, []string{tt.in})
82 addrs, err := LookupHost(tt.in)
84 t.Logf("warning: LookupHost(%q) = %v, want error", tt.in, addrs)
88 if tt.out != nil {
89 ips, err := LookupIP(tt.in)
90 if len(ips) != 1 || !reflect.DeepEqual(ips[0], tt.out) || err != nil {
91 t.Errorf("LookupIP(%q) = %v, %v, want %v, nil", tt.in, ips, err, []IP{tt.out})
94 ips, err := LookupIP(tt.in)
97 t.Logf("warning: LookupIP(%q) = %v, want error", tt.in, ips)
107 for _, tt := range parseIPTests {
108 ParseIP(tt.in)
239 for _, tt := range ipStringTests {
240 if out := tt.in.String(); out != tt.str {
241 t.Errorf("IP.String(%v) = %q, want %q", tt.in, out, tt.str)
243 if out, err := tt.in.MarshalText(); !bytes.Equal(out, tt.byt) || !reflect.DeepEqual(err, tt.error) {
244 t.Errorf("IP.MarshalText(%v) = %v, %v, want %v, %v", tt.in, out, err, tt.byt, tt.error)
255 for _, tt := range ipStringTests {
256 if tt.in != nil {
257 sink = tt.in.String()
277 for _, tt := range ipMaskTests {
278 if out := tt.in.Mask(tt.mask); out == nil || !tt.out.Equal(out) {
279 t.Errorf("IP(%v).Mask(%v) = %v, want %v", tt.in, tt.mask, out, tt.out)
296 for _, tt := range ipMaskStringTests {
297 if out := tt.in.String(); out != tt.out {
298 t.Errorf("IPMask.String(%v) = %q, want %q", tt.in, out, tt.out)
307 for _, tt := range ipMaskStringTests {
308 sink = tt.in.String()
349 for _, tt := range parseCIDRTests {
350 ip, net, err := ParseCIDR(tt.in)
351 if !reflect.DeepEqual(err, tt.err) {
352 t.Errorf("ParseCIDR(%q) = %v, %v; want %v, %v", tt.in, ip, net, tt.ip, tt.net)
354 if err == nil && (!tt.ip.Equal(ip) || !tt.net.IP.Equal(net.IP) || !reflect.DeepEqual(net.Mask, tt.net.Mask)) {
355 t.Errorf("ParseCIDR(%q) = %v, {%v, %v}; want %v, {%v, %v}", tt.in, ip, net.IP, net.Mask, tt.ip, tt.net.IP, tt.net.Mask)
376 for _, tt := range ipNetContainsTests {
377 if ok := tt.net.Contains(tt.ip); ok != tt.ok {
378 t.Errorf("IPNet(%v).Contains(%v) = %v, want %v", tt.net, tt.ip, ok, tt.ok)
394 for _, tt := range ipNetStringTests {
395 if out := tt.in.String(); out != tt.out {
396 t.Errorf("IPNet.String(%v) = %q, want %q", tt.in, out, tt.out)
421 for _, tt := range cidrMaskTests {
422 if out := CIDRMask(tt.ones, tt.bits); !reflect.DeepEqual(out, tt.out) {
423 t.Errorf("CIDRMask(%v, %v) = %v, want %v", tt.ones, tt.bits, out, tt.out)
462 for _, tt := range networkNumberAndMaskTests {
463 ip, m := networkNumberAndMask(&tt.in)
465 if !reflect.DeepEqual(&tt.out, out) {
466 t.Errorf("networkNumberAndMask(%v) = %v, want %v", tt.in, out, &tt.out)
520 for _, tt := range splitJoinTests {
521 if host, port, err := SplitHostPort(tt.join); host != tt.host || port != tt.port || err != nil {
522 t.Errorf("SplitHostPort(%q) = %q, %q, %v; want %q, %q, nil", tt.join, host, port, err, tt.host, tt.port)
525 for _, tt := range splitFailureTests {
526 if host, port, err := SplitHostPort(tt.hostPort); err == nil {
527 t.Errorf("SplitHostPort(%q) should have failed", tt.hostPort)
530 if e.Err != tt.err {
531 t.Errorf("SplitHostPort(%q) = _, _, %q; want %q", tt.hostPort, e.Err, tt.err)
534 t.Errorf("SplitHostPort(%q) = %q, %q, err; want %q, %q, err on failure", tt.hostPort, host, port, "", "")
541 for _, tt := range splitJoinTests {
542 if join := JoinHostPort(tt.host, tt.port); join != tt.join {
543 t.Errorf("JoinHostPort(%q, %q) = %q; want %q", tt.host, tt.port, join, tt.join)
571 for _, tt := range ipAddrFamilyTests {
572 if af := tt.in.To4() != nil; af != tt.af4 {
573 t.Errorf("verifying IPv4 address family for %q = %v, want %v", tt.in, af, tt.af4)
575 if af := len(tt.in) == IPv6len && tt.in.To4() == nil; af != tt.af6 {
576 t.Errorf("verifying IPv6 address family for %q = %v, want %v", tt.in, af, tt.af6)
635 for _, tt := range ipAddrScopeTests {
636 if ok := tt.scope(tt.in); ok != tt.ok {
637 t.Errorf("%s(%q) = %v, want %v", name(tt.scope), tt.in, ok, tt.ok)
639 ip := tt.in.To4()
643 if ok := tt.scope(ip); ok != tt.ok {
644 t.Errorf("%s(%q) = %v, want %v", name(tt.scope), ip, ok, tt.ok)