Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2947)

Delta Between Two Patch Sets: src/pkg/net/multicast_test.go

Issue 4174056: net: fix multicast tests (Closed)
Left Patch Set: Created 13 years, 1 month ago
Right Patch Set: diff -r 8e157f1abc87 https://go.googlecode.com/hg/ Created 13 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package net 5 package net
6 6
7 import ( 7 import (
8 "runtime" 8 "runtime"
9 "testing" 9 "testing"
10 ) 10 )
11 11
12 func TestMulticastJoinAndLeave(t *testing.T) { 12 func TestMulticastJoinAndLeave(t *testing.T) {
13 if runtime.GOOS == "windows" { 13 if runtime.GOOS == "windows" {
14 return 14 return
15 } 15 }
16
16 addr := &UDPAddr{ 17 addr := &UDPAddr{
17 IP: IPv4zero, 18 IP: IPv4zero,
18 Port: 0, 19 Port: 0,
19 } 20 }
20 // open a UDPConn 21 // open a UDPConn
21 conn, err := ListenUDP("udp4", addr) 22 conn, err := ListenUDP("udp4", addr)
22 if err != nil { 23 if err != nil {
23 t.Fatal(err) 24 t.Fatal(err)
24 } 25 }
25 defer conn.Close() 26 defer conn.Close()
26 27
27 // try to join group 28 // try to join group
28 » mcast := IPv4(224, 0, 0, 251) 29 » mcast := IPv4(224, 0, 0, 254)
29 err = conn.JoinGroup(mcast) 30 err = conn.JoinGroup(mcast)
30 if err != nil { 31 if err != nil {
31 t.Fatal(err) 32 t.Fatal(err)
32 } 33 }
33 34
34 // try to leave group 35 // try to leave group
35 err = conn.LeaveGroup(mcast) 36 err = conn.LeaveGroup(mcast)
36 if err != nil { 37 if err != nil {
37 t.Fatal(err) 38 t.Fatal(err)
38 } 39 }
39 } 40 }
40 41
41 func TestJoinFailureWithIPv6Address(t *testing.T) { 42 func TestJoinFailureWithIPv6Address(t *testing.T) {
42 addr := &UDPAddr{ 43 addr := &UDPAddr{
43 IP: IPv4zero, 44 IP: IPv4zero,
44 Port: 0, 45 Port: 0,
45 } 46 }
46 47
47 // open a UDPConn 48 // open a UDPConn
48 conn, err := ListenUDP("udp4", addr) 49 conn, err := ListenUDP("udp4", addr)
49 if err != nil { 50 if err != nil {
50 t.Fatal(err) 51 t.Fatal(err)
51 } 52 }
52 defer conn.Close() 53 defer conn.Close()
54
53 // try to join group 55 // try to join group
54 mcast := ParseIP("ff02::1") 56 mcast := ParseIP("ff02::1")
55 err = conn.JoinGroup(mcast) 57 err = conn.JoinGroup(mcast)
56 if err == nil { 58 if err == nil {
57 t.Fatal("JoinGroup succeeded, should fail") 59 t.Fatal("JoinGroup succeeded, should fail")
58 } 60 }
59 t.Logf("%s", err) 61 t.Logf("%s", err)
60 } 62 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b