-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae631a3
commit cb58113
Showing
2 changed files
with
219 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package helper_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/bschaatsbergen/cidr/pkg/helper" | ||
) | ||
|
||
func TestContainsInt(t *testing.T) { | ||
type args struct { | ||
ints []int | ||
specifiedInt int | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want bool | ||
}{ | ||
{ | ||
name: "ContainsInt() should return true", | ||
args: args{ | ||
ints: []int{1, 2, 3, 4, 5}, | ||
specifiedInt: 3, | ||
}, | ||
want: true, | ||
}, | ||
{ | ||
name: "ContainsInt() should return false", | ||
args: args{ | ||
ints: []int{1, 2, 3, 4, 5}, | ||
specifiedInt: 6, | ||
}, | ||
want: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := helper.ContainsInt(tt.args.ints, tt.args.specifiedInt); got != tt.want { | ||
t.Errorf("ContainsInt() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |