summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/option_requested_ip_address_test.go
diff options
context:
space:
mode:
authorAndrea Barberio <insomniac@slackware.it>2018-03-18 09:19:32 -0700
committerAndrea Barberio <insomniac@slackware.it>2018-03-18 09:19:32 -0700
commite73a39c9e10a62f7e61949665b2afefc5b094f64 (patch)
treed85440f29f9aecf4b9d5e00a699314317831351e /dhcpv4/option_requested_ip_address_test.go
parent1cc89131993b14e10204f15d92c7fd74ef20d3bd (diff)
Fixed file names that had the content swapped
Diffstat (limited to 'dhcpv4/option_requested_ip_address_test.go')
-rw-r--r--dhcpv4/option_requested_ip_address_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/dhcpv4/option_requested_ip_address_test.go b/dhcpv4/option_requested_ip_address_test.go
index 2951ebb..efd6299 100644
--- a/dhcpv4/option_requested_ip_address_test.go
+++ b/dhcpv4/option_requested_ip_address_test.go
@@ -7,38 +7,38 @@ import (
"github.com/stretchr/testify/require"
)
-func TestOptServerIdentifierInterfaceMethods(t *testing.T) {
+func TestOptRequestedIPAddressInterfaceMethods(t *testing.T) {
ip := net.IP{192, 168, 0, 1}
- o := OptServerIdentifier{ServerID: ip}
+ o := OptRequestedIPAddress{RequestedAddr: ip}
- require.Equal(t, OptionServerIdentifier, o.Code(), "Code")
+ require.Equal(t, OptionRequestedIPAddress, o.Code(), "Code")
- expectedBytes := []byte{54, 4, 192, 168, 0, 1}
+ expectedBytes := []byte{byte(OptionRequestedIPAddress), 4, 192, 168, 0, 1}
require.Equal(t, expectedBytes, o.ToBytes(), "ToBytes")
require.Equal(t, 4, o.Length(), "Length")
- require.Equal(t, "Server Identifier -> 192.168.0.1", o.String(), "String")
+ require.Equal(t, "Requested IP Address -> 192.168.0.1", o.String(), "String")
}
-func TestParseOptServerIdentifier(t *testing.T) {
+func TestParseOptRequestedIPAddress(t *testing.T) {
var (
- o *OptServerIdentifier
+ o *OptRequestedIPAddress
err error
)
- o, err = ParseOptServerIdentifier([]byte{})
+ o, err = ParseOptRequestedIPAddress([]byte{})
require.Error(t, err, "empty byte stream")
- o, err = ParseOptServerIdentifier([]byte{54, 4, 192})
+ o, err = ParseOptRequestedIPAddress([]byte{byte(OptionRequestedIPAddress), 4, 192})
require.Error(t, err, "short byte stream")
- o, err = ParseOptServerIdentifier([]byte{54, 3, 192, 168, 0, 1})
+ o, err = ParseOptRequestedIPAddress([]byte{byte(OptionRequestedIPAddress), 3, 192, 168, 0, 1})
require.Error(t, err, "wrong IP length")
- o, err = ParseOptServerIdentifier([]byte{53, 4, 192, 168, 1})
+ o, err = ParseOptRequestedIPAddress([]byte{53, 4, 192, 168, 1})
require.Error(t, err, "wrong option code")
- o, err = ParseOptServerIdentifier([]byte{54, 4, 192, 168, 0, 1})
+ o, err = ParseOptRequestedIPAddress([]byte{byte(OptionRequestedIPAddress), 4, 192, 168, 0, 1})
require.NoError(t, err)
- require.Equal(t, net.IP{192, 168, 0, 1}, o.ServerID)
+ require.Equal(t, net.IP{192, 168, 0, 1}, o.RequestedAddr)
}