Debian Codegraph @

tools/math_test.go

raw symbols SCIP
1 package tools
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/assert"
7 )
8
9 func TestClampDiscardsIntsLowerThanMin(t *testing.T) {
10 assert.Equal(t, 0, ClampInt(-1, 0, 1))
11 }
12
13 func TestClampDiscardsIntsGreaterThanMax(t *testing.T) {
14 assert.Equal(t, 1, ClampInt(2, 0, 1))
15 }
16
17 func TestClampAcceptsIntsWithinBounds(t *testing.T) {
18 assert.Equal(t, 1, ClampInt(1, 0, 2))
19 }