mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-05 06:26:08 +00:00
cc1975988d
remove boundary limits for DeleteMessages rename deleteMessages to deleteMessagesRaw use constant instead of limit literal add min helper func rename utils.go to math.go
40 lines
596 B
Go
40 lines
596 B
Go
package api
|
|
|
|
import "testing"
|
|
|
|
func Test_min(t *testing.T) {
|
|
testCases := []struct {
|
|
name string
|
|
a, b int
|
|
expect int
|
|
}{
|
|
{
|
|
name: "first smaller",
|
|
a: 1,
|
|
b: 2,
|
|
expect: 1,
|
|
},
|
|
{
|
|
name: "both equal",
|
|
a: 1,
|
|
b: 1,
|
|
expect: 1,
|
|
},
|
|
{
|
|
name: "last smaller",
|
|
a: 2,
|
|
b: 1,
|
|
expect: 1,
|
|
},
|
|
}
|
|
|
|
for _, c := range testCases {
|
|
t.Run(c.name, func(t *testing.T) {
|
|
actual := min(c.a, c.b)
|
|
if c.expect != actual {
|
|
t.Errorf("expected min(%d, %d) to return %d, but did %d", c.a, c.b, c.expect, actual)
|
|
}
|
|
})
|
|
}
|
|
}
|