mirror of
https://github.com/junegunn/fzf
synced 2024-11-12 07:11:11 +00:00
23 lines
343 B
Go
23 lines
343 B
Go
package util
|
|
|
|
import "testing"
|
|
|
|
func TestMax(t *testing.T) {
|
|
if Max(-2, 5, 1, 4, 3) != 5 {
|
|
t.Error("Invalid result")
|
|
}
|
|
}
|
|
|
|
func TestContrain(t *testing.T) {
|
|
if Constrain(-3, -1, 3) != -1 {
|
|
t.Error("Expected", -1)
|
|
}
|
|
if Constrain(2, -1, 3) != 2 {
|
|
t.Error("Expected", 2)
|
|
}
|
|
|
|
if Constrain(5, -1, 3) != 3 {
|
|
t.Error("Expected", 3)
|
|
}
|
|
}
|