MCPcopy
hub / github.com/cayleygraph/cayley / TestRecursiveNext

Function TestRecursiveNext

graph/iterator/recursive_test.go:54–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

52}
53
54func TestRecursiveNext(t *testing.T) {
55 ctx := context.TODO()
56 qs := rec_test_qs
57 start := NewFixed()
58 start.Add(graph.PreFetched(quad.Raw("alice")))
59 r := NewRecursive(start, singleHop(qs, "parent"), 0)
60 expected := []string{"bob", "charlie", "dani", "emily"}
61
62 var got []string
63 for r.Next(ctx) {
64 got = append(got, quad.ToString(qs.NameOf(r.Result())))
65 }
66 sort.Strings(expected)
67 sort.Strings(got)
68 if !reflect.DeepEqual(got, expected) {
69 t.Errorf("Failed to %s, got: %v, expected: %v", "check basic recursive iterator", got, expected)
70 }
71}
72
73func TestRecursiveContains(t *testing.T) {
74 ctx := context.TODO()

Callers

nothing calls this directly

Calls 9

AddMethod · 0.95
PreFetchedFunction · 0.92
NewFixedFunction · 0.85
NewRecursiveFunction · 0.85
singleHopFunction · 0.85
NextMethod · 0.65
NameOfMethod · 0.65
ResultMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected