From 55d9d52d0a25d3826c5109f0bf101448322ec565 Mon Sep 17 00:00:00 2001 From: Andrea Barberio Date: Thu, 7 Dec 2017 23:17:53 +0000 Subject: Refactored options into the dhcpv6 package to resolve circular imports. Sadly. --- dhcpv6/dhcpv6_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'dhcpv6/dhcpv6_test.go') diff --git a/dhcpv6/dhcpv6_test.go b/dhcpv6/dhcpv6_test.go index 3d0c5fc..770d2c4 100644 --- a/dhcpv6/dhcpv6_test.go +++ b/dhcpv6/dhcpv6_test.go @@ -2,7 +2,6 @@ package dhcpv6 import ( "bytes" - "github.com/insomniacslk/dhcp/dhcpv6/options" "testing" ) @@ -88,13 +87,13 @@ func TestSettersAndGetters(t *testing.T) { if len(opts) != 0 { t.Fatalf("Invalid Options. Expected empty array, got %v", opts) } - opt := options.OptionGeneric{OptionCode: 0, OptionData: []byte{}} - d.SetOptions([]options.Option{&opt}) + opt := OptionGeneric{OptionCode: 0, OptionData: []byte{}} + d.SetOptions([]Option{&opt}) opts = d.Options() if len(opts) != 1 { t.Fatalf("Invalid Options. Expected one-element array, got %v", len(opts)) } - if _, ok := opts[0].(*options.OptionGeneric); !ok { + if _, ok := opts[0].(*OptionGeneric); !ok { t.Fatalf("Invalid Options. Expected one OptionGeneric, got %v", opts[0]) } } @@ -105,13 +104,13 @@ func TestAddOption(t *testing.T) { if len(opts) != 0 { t.Fatalf("Invalid Options. Expected empty array, got %v", opts) } - opt := options.OptionGeneric{OptionCode: 0, OptionData: []byte{}} + opt := OptionGeneric{OptionCode: 0, OptionData: []byte{}} d.AddOption(&opt) opts = d.Options() if len(opts) != 1 { t.Fatalf("Invalid Options. Expected one-element array, got %v", len(opts)) } - if _, ok := opts[0].(*options.OptionGeneric); !ok { + if _, ok := opts[0].(*OptionGeneric); !ok { t.Fatalf("Invalid Options. Expected one OptionGeneric, got %v", opts[0]) } } @@ -120,7 +119,7 @@ func TestToBytes(t *testing.T) { d := DHCPv6Message{} d.SetMessage(SOLICIT) d.SetTransactionID(0xabcdef) - opt := options.OptionGeneric{OptionCode: 0, OptionData: []byte{}} + opt := OptionGeneric{OptionCode: 0, OptionData: []byte{}} d.AddOption(&opt) toBytes := d.ToBytes() expected := []byte{01, 0xab, 0xcd, 0xef, 0x00, 0x00, 0x00, 0x00} -- cgit v1.2.3