func Test2iScanRange(t *testing.T) {
	c.LogIgnore()
	//c.SetLogLevel(c.LogLevelDebug)
	low, high := value.NewValue("aaaa"), value.NewValue("zzzz")
	span := &datastore.Span{
		Range: &datastore.Range{
			Low:       value.Values{low},
			High:      value.Values{high},
			Inclusion: datastore.BOTH,
		},
	}
	conn := datastore.NewIndexConnection(nil)
	entrych := conn.EntryChannel()
	quitch := conn.StopChannel()

	go index.Scan("", span, false, 10000, conn)

	count := 0
loop:
	for {
		select {
		case _, ok := <-entrych:
			if !ok {
				break loop
			}
			count++
		case <-quitch:
			break loop
		}
	}
	if count != 20000 {
		t.Fatal("failed ScanRange() - ", count)
	}
}
func Test2iScanEntries(t *testing.T) {
	c.LogIgnore()
	//c.SetLogLevel(c.LogLevelDebug)
	conn := datastore.NewIndexConnection(nil)
	entrych := conn.EntryChannel()
	quitch := conn.StopChannel()

	go index.ScanEntries(10000, conn)

	count := 0
loop:
	for {
		select {
		case _, ok := <-entrych:
			if !ok {
				break loop
			}
			count++

		case <-quitch:
			break loop
		}
	}
	if count != 20000 {
		t.Fatal("failed ScanEntries() - ", count)
	}
}
func Test2iStatistics(t *testing.T) {
	c.LogIgnore()
	low, high := value.NewValue("aaaa"), value.NewValue("zzzz")
	span := &datastore.Span{
		Range: &datastore.Range{
			Low:       value.Values{low},
			High:      value.Values{high},
			Inclusion: datastore.BOTH,
		},
	}
	out, err := index.Statistics("", span)
	if err != nil {
		t.Fatal(err)
	}
	ref := &statistics{
		count:      100,
		uniqueKeys: 100,
		min:        []uint8{0x22, 0x61, 0x61, 0x61, 0x61, 0x61, 0x22},
		max:        []uint8{0x22, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x22},
	}
	if reflect.DeepEqual(out, ref) == false {
		t.Fatalf("failed index.Statistics() %#v", out)
	}
}