diff options
author | Ghanan Gowripalan <ghanan@google.com> | 2020-11-24 11:48:09 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-24 11:50:00 -0800 |
commit | 732e98985546958fdab8ae3d49e36f17ae89f71c (patch) | |
tree | 16efeda1f25304990fad6676fa50a509d0b9f84a /pkg/tcpip/tcpip_test.go | |
parent | e5fd23c18d1fd602603babd8297dabf679c336aa (diff) |
Extract IGMPv2 core state machine
The IGMPv2 core state machine can be shared with MLDv1 since they are
almost identical, ignoring specific addresses, constants and packets.
Bug #4682, #4861
PiperOrigin-RevId: 344102615
Diffstat (limited to 'pkg/tcpip/tcpip_test.go')
-rw-r--r-- | pkg/tcpip/tcpip_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/pkg/tcpip/tcpip_test.go b/pkg/tcpip/tcpip_test.go index 1c8e2bc34..c461da137 100644 --- a/pkg/tcpip/tcpip_test.go +++ b/pkg/tcpip/tcpip_test.go @@ -226,3 +226,47 @@ func TestAddressWithPrefixSubnet(t *testing.T) { } } } + +func TestAddressUnspecified(t *testing.T) { + tests := []struct { + addr Address + unspecified bool + }{ + { + addr: "", + unspecified: true, + }, + { + addr: "\x00", + unspecified: true, + }, + { + addr: "\x01", + unspecified: false, + }, + { + addr: "\x00\x00", + unspecified: true, + }, + { + addr: "\x01\x00", + unspecified: false, + }, + { + addr: "\x00\x01", + unspecified: false, + }, + { + addr: "\x01\x01", + unspecified: false, + }, + } + + for _, test := range tests { + t.Run(fmt.Sprintf("addr=%s", test.addr), func(t *testing.T) { + if got := test.addr.Unspecified(); got != test.unspecified { + t.Fatalf("got addr.Unspecified() = %t, want = %t", got, test.unspecified) + } + }) + } +} |