mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 18:57:17 -07:00
start adding tests for network net
* IsZeroMac * IsBroadcastMac * NormalizeMac
This commit is contained in:
parent
480f0daa8d
commit
9e59ca9bfe
1 changed files with 34 additions and 0 deletions
34
network/net_test.go
Normal file
34
network/net_test.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package network
|
||||
|
||||
import (
|
||||
"net"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsZeroMac(t *testing.T) {
|
||||
exampleMAC, _ := net.ParseMAC("00:00:00:00:00:00")
|
||||
|
||||
exp := true
|
||||
got := IsZeroMac(exampleMAC)
|
||||
if got != exp {
|
||||
t.Fatalf("expected '%t', got '%t'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsBroadcastMac(t *testing.T) {
|
||||
exampleMAC, _ := net.ParseMAC("ff:ff:ff:ff:ff:ff")
|
||||
|
||||
exp := true
|
||||
got := IsBroadcastMac(exampleMAC)
|
||||
if got != exp {
|
||||
t.Fatalf("expected '%t', got '%t'", exp, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeMac(t *testing.T) {
|
||||
exp := "ff:ff:ff:ff:ff:ff"
|
||||
got := NormalizeMac("fF-fF-fF-fF-fF-fF")
|
||||
if got != exp {
|
||||
t.Fatalf("expected '%s', got '%s'", exp, got)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue