-
Notifications
You must be signed in to change notification settings - Fork 0
/
options_test.go
56 lines (46 loc) · 1.2 KB
/
options_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package macpot_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/yitsushi/macpot"
)
func TestNew_AsMulticast(t *testing.T) {
mac, err := macpot.New(
macpot.WithOUI("12:22:33"),
macpot.WithNICFromIPv4("192.168.31.7"),
macpot.AsMulticast(),
)
assert.Condition(t, mac.IsMulticast)
assert.NoError(t, err)
assert.Equal(t, "13:22:33:a8:1f:07", mac.ToString())
}
func TestNew_AsUnicast(t *testing.T) {
mac, err := macpot.New(
macpot.WithOUI("13:22:33"),
macpot.WithNICFromIPv4("192.168.31.7"),
macpot.AsUnicast(),
)
assert.Condition(t, mac.IsUnicast)
assert.NoError(t, err)
assert.Equal(t, "12:22:33:a8:1f:07", mac.ToString())
}
func TestNew_AsLocal(t *testing.T) {
mac, err := macpot.New(
macpot.WithOUI("14:22:33"),
macpot.WithNICFromIPv4("192.168.31.7"),
macpot.AsLocal(),
)
assert.Condition(t, mac.IsLocal)
assert.NoError(t, err)
assert.Equal(t, "16:22:33:a8:1f:07", mac.ToString())
}
func TestNew_AsGlobal(t *testing.T) {
mac, err := macpot.New(
macpot.WithOUI("16:22:33"),
macpot.WithNICFromIPv4("192.168.31.7"),
macpot.AsGlobal(),
)
assert.Condition(t, mac.IsGlobal)
assert.NoError(t, err)
assert.Equal(t, "14:22:33:a8:1f:07", mac.ToString())
}