github.com/cilium/cilium@v1.16.2/pkg/maps/ipcache/ipcache_test.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package ipcache
     5  
     6  import (
     7  	"testing"
     8  )
     9  
    10  func TestRemoteEndpointInfoFlagsStringReturnsCorrectValue(t *testing.T) {
    11  	type stringTest struct {
    12  		name string
    13  		in   RemoteEndpointInfoFlags
    14  		out  string
    15  	}
    16  
    17  	tests := []stringTest{
    18  		{
    19  			name: "no flags",
    20  			in:   0,
    21  			out:  "<none>",
    22  		},
    23  		{
    24  			name: "FlagSkipTunnel",
    25  			in:   FlagSkipTunnel,
    26  			out:  "skiptunnel",
    27  		},
    28  	}
    29  
    30  	for _, test := range tests {
    31  		if s := test.in.String(); s != test.out {
    32  			t.Errorf(
    33  				"Expected '%s' for string representation of %s, instead got '%s'",
    34  				test.out, test.name, s,
    35  			)
    36  		}
    37  	}
    38  }