1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

Merge branch 'main' into v2

This commit is contained in:
dudaodong
2022-10-19 17:31:51 +08:00
2 changed files with 4 additions and 1 deletions

View File

@@ -14,5 +14,5 @@ type Comparator interface {
// Number contains all types of number and uintptr, used for generics constraint
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
}

View File

@@ -87,6 +87,9 @@ func TestMax(t *testing.T) {
assert.Equal(Max(0, 0), 0)
assert.Equal(Max(1, 2, 3), 3)
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) {