strip-beats/utils/utils_tern_test.go
2023-10-29 11:58:00 -05:00

25 lines
434 B
Go

package utils
import (
"testing"
)
func TestTern(t *testing.T) {
out := Tern(true, 5, 2)
if out != 5 {
t.Fatalf(`Tern(%v, %d, %d) = %v, want %d`, true, 5, 2, out, 5)
}
}
func TestTernCall(t *testing.T) {
five := func() int {
return 5
}
two := func() int {
return 2
}
out := TernCall(true, five, two)
if out != 5 {
t.Fatalf(`TernCall(%v, func () { return 5}, func () {return 2}) = %v, want %d`, true, out, 5)
}
}