From 2ab9b4cf583c3b4dec6896e9b954f42630825215 Mon Sep 17 00:00:00 2001
From: Daniel Czerwonk <daniel@dan-nrw.de>
Date: Sat, 12 May 2018 15:51:13 +0200
Subject: [PATCH] added tests for the helper method

---
 net/helper_test.go | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 net/helper_test.go

diff --git a/net/helper_test.go b/net/helper_test.go
new file mode 100644
index 00000000..7503a685
--- /dev/null
+++ b/net/helper_test.go
@@ -0,0 +1,32 @@
+package net
+
+import (
+	"testing"
+
+	"github.com/stretchr/testify/assert"
+)
+
+func IPv4ToUint32Test(t *testing.T) {
+	tests := []struct {
+		input    []byte
+		expected uint32
+	}{
+		{
+			input:    []byte{192, 168, 1, 5},
+			expected: 3232235781,
+		},
+		{
+			input:    []byte{10, 0, 0, 0},
+			expected: 167772160,
+		},
+		{
+			input:    []byte{172, 24, 5, 1},
+			expected: 2887255297,
+		},
+	}
+
+	for _, test := range tests {
+		res := IPv4ToUint32(test.input)
+		assert.Equal(t, test.expected, res)
+	}
+}
-- 
GitLab