mirror of
https://github.com/vxcontrol/langchaingo.git
synced 2026-07-21 00:45:22 -04:00
77504b877f
* 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
46 lines
700 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|