Ejemplo n.º 1
0
func TestMorphisms(t *testing.T) {
	qs := makeTestStore(t)
	for _, test := range testSet(qs) {
		var got []quad.Value
		if test.tag == "" {
			got = runTopLevel(test.path)
		} else {
			got = runTag(test.path, test.tag)
		}
		sort.Sort(quad.ByValueString(got))
		sort.Sort(quad.ByValueString(test.expect))
		if !reflect.DeepEqual(got, test.expect) {
			t.Errorf("Failed to %s, got: %v(%d) expected: %v(%d)", test.message, got, len(got), test.expect, len(test.expect))
		}
	}
}
Ejemplo n.º 2
0
func IteratedValues(t testing.TB, qs graph.QuadStore, it graph.Iterator) []quad.Value {
	var res []quad.Value
	for it.Next() {
		res = append(res, qs.NameOf(it.Result()))
	}
	require.Nil(t, it.Err())
	sort.Sort(quad.ByValueString(res))
	return res
}