Skip to content

Commit

Permalink
Test utils.MaxInt()
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Sep 3, 2024
1 parent 6e6ccd5 commit d2a2a42
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ func TestEllipsize(t *testing.T) {
}
}

func TestMaxInt(t *testing.T) {
subtests := []struct {
name string
x int
y int
output int
}{
{"less", 23, 42, 42},
{"equal", 42, 42, 42},
{"greater", 42, 23, 42},
}

for _, st := range subtests {
t.Run(st.name, func(t *testing.T) {
require.Equal(t, st.output, MaxInt(st.x, st.y))
})
}
}

func TestChanFromSlice(t *testing.T) {
t.Run("Nil", func(t *testing.T) {
ch := ChanFromSlice[int](nil)
Expand Down

0 comments on commit d2a2a42

Please sign in to comment.