go-prompt/bisect_test.go

22 lines
381 B
Go
Raw Normal View History

2017-08-14 16:50:21 +00:00
package prompt
import (
"testing"
)
// Thanks!! https://play.golang.org/p/y9NRj_XVIW
func TestBisectRight(t *testing.T) {
in := []int{1, 2, 3, 3, 3, 6, 7}
r := BisectRight(in, 0)
if r != 0 {
2017-08-16 04:39:59 +00:00
t.Errorf("number 0 should inserted at 0 position, but got %d", r)
2017-08-14 16:50:21 +00:00
}
r = BisectRight(in, 4)
if r != 5 {
2017-08-16 04:39:59 +00:00
t.Errorf("number 4 should inserted at 5 position, but got %d", r)
2017-08-14 16:50:21 +00:00
}
}