summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/dhcpv4_test.go
diff options
context:
space:
mode:
authorSean Karlage <skarlage@fb.com>2018-02-03 21:55:38 -0800
committerSean Karlage <skarlage@fb.com>2018-03-03 11:25:28 -0800
commit28e9aa6c820ffcb9028422b1179c1326dc76229c (patch)
tree4652daf1f69e8696867c5c325f009922a70d3361 /dhcpv4/dhcpv4_test.go
parentac949192ce781902de712ea495b04fc84709ac2e (diff)
Add BSDP support
Adds support for constructing INFORM/ACK messages from Apple's Boot Service Discovery Protocol for netbooting (pxebooting) Apple hardware. The canonical reference for BSDP is: http://opensource.apple.com/source/bootp/bootp-198.1/Documentation/BSDP.doc
Diffstat (limited to 'dhcpv4/dhcpv4_test.go')
-rw-r--r--dhcpv4/dhcpv4_test.go26
1 files changed, 25 insertions, 1 deletions
diff --git a/dhcpv4/dhcpv4_test.go b/dhcpv4/dhcpv4_test.go
index 5a12207..a3a1955 100644
--- a/dhcpv4/dhcpv4_test.go
+++ b/dhcpv4/dhcpv4_test.go
@@ -2,9 +2,10 @@ package dhcpv4
import (
"bytes"
- "github.com/insomniacslk/dhcp/iana"
"net"
"testing"
+
+ "github.com/insomniacslk/dhcp/iana"
)
// NOTE: if one of the following Assert* fails where expected and got values are
@@ -16,6 +17,29 @@ func AssertEqual(t *testing.T, a, b interface{}, what string) {
}
}
+func AssertNotNil(t *testing.T, a interface{}, what string) {
+ if a == nil {
+ t.Fatalf("Expected %s to not be nil. %v", what, a)
+ }
+}
+
+func AssertNil(t *testing.T, a interface{}, what string) {
+ if a != nil {
+ t.Fatalf("Expected %s to be nil. %v", what, a)
+ }
+}
+
+func AssertEqualSlice(t *testing.T, a, b []interface{}, what string) {
+ if len(a) != len(b) {
+ t.Fatalf("Invalid %s. %v != %v", what, a, b)
+ }
+ for i := range a {
+ if a[i] != b[i] {
+ t.Fatalf("Invalid %s. %v != %v at index %d", what, a, b, i)
+ }
+ }
+}
+
func AssertEqualBytes(t *testing.T, a, b []byte, what string) {
if !bytes.Equal(a, b) {
t.Fatalf("Invalid %s. %v != %v", what, a, b)