Files
Travis Cline 77504b877f all: expand test coverage (#1312)
* scripts: cleanup test scripts
* lint: add test pattern and architectural linting
* internal/httprr: expand httprr testing
* test: add comprehensive unit test coverage
* docs: add comprehensive testing guide to CONTRIBUTING.md
* examples: standardize module versions and cleanup dependencies
* all: re-record several httprr recordings
2025-06-16 18:14:02 +02:00

46 lines
700 B
Go

package sliceutil
import (
"testing"
)
func TestMinInt(t *testing.T) {
t.Parallel()
cases := []struct {
name string
nums []int
expected int
}{
{
name: "ascending order",
nums: []int{1, 2, 3, 23, 34},
expected: 1,
},
{
name: "mixed order",
nums: []int{3, 2, 1, 34, 2213},
expected: 1,
},
{
name: "nil slice",
nums: nil,
expected: 0,
},
{
name: "empty slice",
nums: []int{},
expected: 0,
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := MinInt(tc.nums)
if got != tc.expected {
t.Errorf("MinInt(%v) = %v, want %v", tc.nums, got, tc.expected)
}
})
}
}