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

     1  package functions
     2  
     3  import "testing"
     4  
     5  func Test_Mod(t *testing.T) {
     6  	tests := []struct {
     7  		name     string
     8  		args     []interface{}
     9  		expected int
    10  	}{
    11  		{
    12  			name:     "Mod with 1 and 2",
    13  			args:     []interface{}{1, 2},
    14  			expected: 1,
    15  		},
    16  		{
    17  			name:     "Mod with 2 and 3",
    18  			args:     []interface{}{2, 3},
    19  			expected: 2,
    20  		},
    21  		{
    22  			name:     "Mod with 3 and -4",
    23  			args:     []interface{}{3, -4},
    24  			expected: 3,
    25  		},
    26  		{
    27  			name:     "Mod with 7 and 3",
    28  			args:     []interface{}{7, 3},
    29  			expected: 1,
    30  		},
    31  	}
    32  
    33  	for _, tt := range tests {
    34  		t.Run(tt.name, func(t *testing.T) {
    35  			got := Mod(tt.args...)
    36  			if got != tt.expected {
    37  				t.Errorf("Mod() = %v, want %v", got, tt.expected)
    38  			}
    39  		})
    40  	}
    41  }