diff options
Diffstat (limited to 'dhcpv6')
-rw-r--r-- | dhcpv6/client_test.go | 14 | ||||
-rw-r--r-- | dhcpv6/server_test.go | 21 |
2 files changed, 35 insertions, 0 deletions
diff --git a/dhcpv6/client_test.go b/dhcpv6/client_test.go new file mode 100644 index 0000000..d2efa1f --- /dev/null +++ b/dhcpv6/client_test.go @@ -0,0 +1,14 @@ +package dhcpv6 + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNewClient(t *testing.T) { + c := NewClient() + require.NotNil(t, c) + require.Equal(t, DefaultReadTimeout, c.ReadTimeout) + require.Equal(t, DefaultWriteTimeout, c.WriteTimeout) +} diff --git a/dhcpv6/server_test.go b/dhcpv6/server_test.go new file mode 100644 index 0000000..3794a4f --- /dev/null +++ b/dhcpv6/server_test.go @@ -0,0 +1,21 @@ +package dhcpv6 + +import ( + "net" + "testing" + + "github.com/stretchr/testify/require" +) + +func TestNewServer(t *testing.T) { + laddr := net.UDPAddr{ + IP: net.ParseIP("::1"), + Port: 0, + } + handler := func(conn net.PacketConn, peer net.Addr, m DHCPv6) {} + s := NewServer(laddr, handler) + require.NotNil(t, s) + require.Nil(t, s.conn) + require.Equal(t, laddr, s.LocalAddr) + require.NotNil(t, s.Handler) +} |