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

     1  package functions
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func Test_Or(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: true,
    30  		},
    31  		{
    32  			name:     "And with same false 4 bools",
    33  			args:     []interface{}{false, false, false, false},
    34  			expected: false,
    35  		},
    36  	}
    37  
    38  	for _, tt := range tests {
    39  		t.Run(tt.name, func(t *testing.T) {
    40  			got := Or(tt.args...)
    41  			assert.Equal(t, tt.expected, got)
    42  		})
    43  	}
    44  }