github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/scanners/azure/functions/and_test.go (about)

     1  package functions
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func Test_And(t *testing.T) {
    10  
    11  	tests := []struct {
    12  		name     string
    13  		args     []interface{}
    14  		expected bool
    15  	}{
    16  		{
    17  			name:     "And with same 2 bools",
    18  			args:     []interface{}{true, true},
    19  			expected: true,
    20  		},
    21  		{
    22  			name:     "And with same 3 bools",
    23  			args:     []interface{}{true, true, true},
    24  			expected: true,
    25  		},
    26  		{
    27  			name:     "And with different 4 bools",
    28  			args:     []interface{}{true, true, false, true},
    29  			expected: false,
    30  		},
    31  	}
    32  
    33  	for _, tt := range tests {
    34  		t.Run(tt.name, func(t *testing.T) {
    35  			got := And(tt.args...)
    36  			assert.Equal(t, tt.expected, got)
    37  		})
    38  	}
    39  }