Skip to content
Snippets Groups Projects
Commit 2ab9b4cf authored by Daniel Czerwonk's avatar Daniel Czerwonk
Browse files

added tests for the helper method

parent b9843fc9
Branches
Tags
No related merge requests found
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)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment