mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-13 09:12:28 +08:00
Merge branch 'main' into v2
This commit is contained in:
@@ -14,5 +14,5 @@ type Comparator interface {
|
|||||||
|
|
||||||
// Number contains all types of number and uintptr, used for generics constraint
|
// Number contains all types of number and uintptr, used for generics constraint
|
||||||
type Number interface {
|
type Number interface {
|
||||||
int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | uintptr | float32 | float64
|
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr | ~float32 | ~float64
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,9 @@ func TestMax(t *testing.T) {
|
|||||||
assert.Equal(Max(0, 0), 0)
|
assert.Equal(Max(0, 0), 0)
|
||||||
assert.Equal(Max(1, 2, 3), 3)
|
assert.Equal(Max(1, 2, 3), 3)
|
||||||
assert.Equal(Max(1.2, 1.4, 1.1, 1.4), 1.4)
|
assert.Equal(Max(1.2, 1.4, 1.1, 1.4), 1.4)
|
||||||
|
|
||||||
|
type Integer int
|
||||||
|
assert.Equal(Max(Integer(1), Integer(0)), Integer(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMaxBy(t *testing.T) {
|
func TestMaxBy(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user