github.com/cilium/cilium@v1.16.2/pkg/types/macaddr_test.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package types
     5  
     6  import (
     7  	"net"
     8  	"testing"
     9  
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  var testMACAddress MACAddr = [6]byte{1, 2, 3, 4, 5, 6}
    14  
    15  func TestHardwareAddr(t *testing.T) {
    16  	var expectedAddress net.HardwareAddr = []byte{1, 2, 3, 4, 5, 6}
    17  	result := testMACAddress.hardwareAddr()
    18  
    19  	require.EqualValues(t, expectedAddress, result)
    20  }
    21  
    22  func TestStringMAC(t *testing.T) {
    23  	expectedStr := "01:02:03:04:05:06"
    24  	result := testMACAddress.String()
    25  
    26  	require.Equal(t, expectedStr, result)
    27  }