You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
590 B

package m9zApi
import "testing"
func TestNormalizeLoopCount(t *testing.T) {
tests := []struct {
name string
in int
want int
}{
{name: "default when empty", in: 0, want: defaultLoopCount},
{name: "default when negative", in: -1, want: defaultLoopCount},
{name: "keeps valid value", in: 6, want: 6},
{name: "clamps max value", in: 12, want: maxLoopCount},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := normalizeLoopCount(tt.in); got != tt.want {
t.Fatalf("normalizeLoopCount(%d) = %d, want %d", tt.in, got, tt.want)
}
})
}
}