github.com/x-oss-byte/git-lfs@v2.5.2+incompatible/tools/math_test.go (about) 1 package tools 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func MinIntPicksTheSmallerInt(t *testing.T) { 10 assert.Equal(t, -1, MinInt(-1, 1)) 11 } 12 13 func MaxIntPicksTheBiggertInt(t *testing.T) { 14 assert.Equal(t, 1, MaxInt(-1, 1)) 15 } 16 17 func ClampDiscardsIntsLowerThanMin(t *testing.T) { 18 assert.Equal(t, 0, ClampInt(-1, 0, 1)) 19 } 20 21 func ClampDiscardsIntsGreaterThanMax(t *testing.T) { 22 assert.Equal(t, 1, ClampInt(2, 0, 1)) 23 } 24 25 func ClampAcceptsIntsWithinBounds(t *testing.T) { 26 assert.Equal(t, 1, ClampInt(1, 0, 2)) 27 }