示例#1
0
func TestMaybeFlatmap(t *testing.T) {
	lst := lists.NewList([]lists.Maybe{
		lists.CreateBooleanResult(true),
		lists.CreateBooleanResult(false),
		lists.CreateBooleanResult(true),
	}).FlatMap()
	assert.Equal(t, 2, lst.Count())
}
示例#2
0
func TestFlatMap(t *testing.T) {
	col := []lists.List{
		generateList().Take(1),
		generateList().Take(0),
		generateList().Take(10),
	}
	outerList := lists.NewList(col)
	fm := outerList.FlatMap()
	assert.Equal(t, 11, fm.Count())
}
示例#3
0
func makeBaseList() lists.List {
	return lists.NewList([]int{0, 1, 2})
}
示例#4
0
func TestEmptyList(t *testing.T) {
	el := lists.NewList(nil)
	assert.Equal(t, true, el.Done())
}