github.com/cilium/ebpf@v0.15.1-0.20240517100537-8079b37aa138/features/map_test.go (about)

     1  package features
     2  
     3  import (
     4  	"errors"
     5  	"math"
     6  	"testing"
     7  
     8  	"github.com/cilium/ebpf"
     9  	"github.com/cilium/ebpf/internal"
    10  	"github.com/cilium/ebpf/internal/testutils"
    11  )
    12  
    13  func TestHaveMapType(t *testing.T) {
    14  	testutils.CheckFeatureMatrix(t, haveMapTypeMatrix)
    15  }
    16  
    17  func TestHaveMapFlag(t *testing.T) {
    18  	testutils.CheckFeatureMatrix(t, haveMapFlagsMatrix)
    19  }
    20  
    21  func TestHaveMapTypeInvalid(t *testing.T) {
    22  	if err := HaveMapType(ebpf.MapType(math.MaxUint32)); err == nil {
    23  		t.Fatal("Expected an error")
    24  	} else if errors.Is(err, internal.ErrNotSupported) {
    25  		t.Fatal("Got ErrNotSupported:", err)
    26  	}
    27  }