func TestAndIterator(t *testing.T) {
	all1 := iterator.NewInt64(1, 3)
	all2 := iterator.NewInt64(3, 5)
	and := iterator.NewAnd()
	and.AddSubIterator(all1)
	and.AddSubIterator(all2)

	result := StringResultTreeEvaluator(and)
	expected := "(3 (3) (3))\n"
	if expected != result {
		t.Errorf("Expected %q got %q", expected, result)
	}
}
func TestSingleIterator(t *testing.T) {
	all := iterator.NewInt64(1, 3)
	result := StringResultTreeEvaluator(all)
	expected := "(1)\n(2)\n(3)\n"
	if expected != result {
		t.Errorf("Expected %q got %q", expected, result)
	}
}
Esempio n. 3
0
func newQuadsAllIterator(qs *QuadStore) *quadsAllIterator {
	var out quadsAllIterator
	qs.logmu.RLock()
	id := qs.nextQuadID - 1
	qs.logmu.RUnlock()
	out.Int64 = *iterator.NewInt64(1, id, false)
	out.qs = qs
	return &out
}
Esempio n. 4
0
func newNodesAllIterator(qs *QuadStore) *nodesAllIterator {
	var out nodesAllIterator
	qs.idmu.RLock()
	id := qs.nextID - 1
	qs.idmu.RUnlock()
	out.Int64 = *iterator.NewInt64(1, id, true)
	out.qs = qs
	return &out
}
Esempio n. 5
0
func newQuadsAllIterator(qs *QuadStore) *quadsAllIterator {
	var out quadsAllIterator
	out.Int64 = *iterator.NewInt64(1, qs.nextQuadID-1)
	out.qs = qs
	return &out
}
Esempio n. 6
0
func newNodesAllIterator(qs *QuadStore) *nodesAllIterator {
	var out nodesAllIterator
	out.Int64 = *iterator.NewInt64(1, qs.nextID-1)
	out.qs = qs
	return &out
}
Esempio n. 7
0
func (ts *TripleStore) TriplesAllIterator() graph.Iterator {
	return iterator.NewInt64(0, ts.Size())
}
Esempio n. 8
0
func NewMemstoreQuadsAllIterator(ts *TripleStore) *QuadsAllIterator {
	var out QuadsAllIterator
	out.Int64 = *iterator.NewInt64(1, ts.quadIdCounter-1)
	out.ts = ts
	return &out
}
Esempio n. 9
0
func NewMemstoreNodesAllIterator(ts *TripleStore) *NodesAllIterator {
	var out NodesAllIterator
	out.Int64 = *iterator.NewInt64(1, ts.idCounter-1)
	out.ts = ts
	return &out
}