From 39586f96ae8b9c48fbeafc6367a1c36b61814402 Mon Sep 17 00:00:00 2001 From: Douwe <d.geurtjens@students.uu.nl> Date: Tue, 23 Nov 2021 13:55:39 +0100 Subject: [PATCH] Half tests fixed --- aql/convertQuery_test.go | 82 ++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/aql/convertQuery_test.go b/aql/convertQuery_test.go index a3e442e..03eb162 100644 --- a/aql/convertQuery_test.go +++ b/aql/convertQuery_test.go @@ -125,14 +125,14 @@ func TestTwoEntitiesNoFilter(t *testing.T) { FOR r0 IN member_of FILTER r0._from == e_0._id AND r0._to == e_1._id FILTER length(e_1) != 0 AND length(r0) != 0 - RETURN {"nodes":union_distinct([e_1], []), "rel": union_distinct([r0], [])} + RETURN {"nodes":union_distinct([e_1], []), "rel": union_distinct([r0], []), "mod": union_distinct([], [])} ) FILTER length(e1) != 0 AND length(e_0) != 0 - RETURN {"nodes":union_distinct(flatten(e1[**].nodes), [e_0]), "rel": union_distinct(flatten(e1[**].rel), [])} + RETURN {"nodes":union_distinct(flatten(e1[**].nodes), [e_0]), "rel": union_distinct(flatten(e1[**].rel), []), "mod": union_distinct(flatten(e1[**].mod), [])} ) -let nodes = union_distinct(flatten(result[**].nodes),[]) -let edges = union_distinct(flatten(result[**].rel),[]) -return {"vertices":nodes,"edges":edges}`) +LET nodes = union_distinct(flatten(result[**].nodes),[]) +LET edges = union_distinct(flatten(result[**].rel),[]) +RETURN {"vertices":nodes,"edges":edges}`) regExCleaner := regexp.MustCompile(`\s+`) correctCleanedResult := regExCleaner.ReplaceAllString(string(correctConvertedResult), " ") convertedCleanedResult := regExCleaner.ReplaceAllString(*convertedResult, " ") @@ -218,14 +218,14 @@ func TestTwoEntitiesOneEntityFilter(t *testing.T) { FILTER e_1.seats < 10 FILTER r0._from == e_0._id AND r0._to == e_1._id FILTER length(e_1) != 0 AND length(r0) != 0 - RETURN {"nodes":union_distinct([e_1], []), "rel": union_distinct([r0], [])} + RETURN {"nodes":union_distinct([e_1], []), "rel": union_distinct([r0], []), "mod": union_distinct([], [])} ) FILTER length(e1) != 0 AND length(e_0) != 0 - RETURN {"nodes":union_distinct(flatten(e1[**].nodes), [e_0]), "rel": union_distinct(flatten(e1[**].rel), [])} + RETURN {"nodes":union_distinct(flatten(e1[**].nodes), [e_0]), "rel": union_distinct(flatten(e1[**].rel), []), "mod": union_distinct(flatten(e1[**].mod), [])} ) -let nodes = union_distinct(flatten(result[**].nodes),[]) -let edges = union_distinct(flatten(result[**].rel),[]) -return {"vertices":nodes,"edges":edges}`) +LET nodes = union_distinct(flatten(result[**].nodes),[]) +LET edges = union_distinct(flatten(result[**].rel),[]) +RETURN {"vertices":nodes,"edges":edges}`) regExCleaner := regexp.MustCompile(`\s+`) correctCleanedResult := regExCleaner.ReplaceAllString(string(correctConvertedResult), " ") convertedCleanedResult := regExCleaner.ReplaceAllString(*convertedResult, " ") @@ -318,14 +318,14 @@ func TestTwoEntitiesTwoEntityFilters(t *testing.T) { FILTER e_1.seats < 10 FILTER r0._from == e_0._id AND r0._to == e_1._id FILTER length(e_1) != 0 AND length(r0) != 0 - RETURN {"nodes":union_distinct([e_1], []), "rel": union_distinct([r0], [])} + RETURN {"nodes":union_distinct([e_1], []), "rel": union_distinct([r0], []), "mod": union_distinct([], [])} ) FILTER length(e1) != 0 AND length(e_0) != 0 - RETURN {"nodes":union_distinct(flatten(e1[**].nodes), [e_0]), "rel": union_distinct(flatten(e1[**].rel), [])} + RETURN {"nodes":union_distinct(flatten(e1[**].nodes), [e_0]), "rel": union_distinct(flatten(e1[**].rel), []), "mod": union_distinct(flatten(e1[**].mod), [])} ) -let nodes = union_distinct(flatten(result[**].nodes),[]) -let edges = union_distinct(flatten(result[**].rel),[]) -return {"vertices":nodes,"edges":edges}`) +LET nodes = union_distinct(flatten(result[**].nodes),[]) +LET edges = union_distinct(flatten(result[**].rel),[]) +RETURN {"vertices":nodes,"edges":edges}`) regExCleaner := regexp.MustCompile(`\s+`) correctCleanedResult := regExCleaner.ReplaceAllString(string(correctConvertedResult), " ") convertedCleanedResult := regExCleaner.ReplaceAllString(*convertedResult, " ") @@ -426,17 +426,17 @@ func TestThreeEntitiesNoFilter(t *testing.T) { FOR r1 IN submits FILTER r1._from == e_0._id AND r1._to == e_2._id FILTER length(e_2) != 0 AND length(r1) != 0 - RETURN {"nodes":union_distinct([e_2], []), "rel": union_distinct([r1], [])} + RETURN {"nodes":union_distinct([e_2], []), "rel": union_distinct([r1], []), "mod": union_distinct([], [])} ) FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0 - RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0])} + RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0]), "mod": union_distinct(flatten(e2[**].mod), [])} ) FILTER length(e0) != 0 AND length(e_1) != 0 - RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), [])} + RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), []), "mod": union_distinct(flatten(e0[**].mod), [])} ) -let nodes = union_distinct(flatten(result[**].nodes),[]) -let edges = union_distinct(flatten(result[**].rel),[]) -return {"vertices":nodes,"edges":edges}`) +LET nodes = union_distinct(flatten(result[**].nodes),[]) +LET edges = union_distinct(flatten(result[**].rel),[]) +RETURN {"vertices":nodes,"edges":edges}`) regExCleaner := regexp.MustCompile(`\s+`) correctCleanedResult := regExCleaner.ReplaceAllString(string(correctConvertedResult), " ") convertedCleanedResult := regExCleaner.ReplaceAllString(*convertedResult, " ") @@ -545,17 +545,17 @@ func TestThreeEntitiesOneEntityFilter(t *testing.T) { FOR r1 IN submits FILTER r1._from == e_0._id AND r1._to == e_2._id FILTER length(e_2) != 0 AND length(r1) != 0 - RETURN {"nodes":union_distinct([e_2], []), "rel": union_distinct([r1], [])} + RETURN {"nodes":union_distinct([e_2], []), "rel": union_distinct([r1], []), "mod": union_distinct([], [])} ) FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0 - RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0])} + RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0]), "mod": union_distinct(flatten(e2[**].mod), [])} ) FILTER length(e0) != 0 AND length(e_1) != 0 - RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), [])} + RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), []), "mod": union_distinct(flatten(e0[**].mod), [])} ) -let nodes = union_distinct(flatten(result[**].nodes),[]) -let edges = union_distinct(flatten(result[**].rel),[]) -return {"vertices":nodes,"edges":edges}`) +LET nodes = union_distinct(flatten(result[**].nodes),[]) +LET edges = union_distinct(flatten(result[**].rel),[]) +RETURN {"vertices":nodes,"edges":edges}`) regExCleaner := regexp.MustCompile(`\s+`) correctCleanedResult := regExCleaner.ReplaceAllString(string(correctConvertedResult), " ") convertedCleanedResult := regExCleaner.ReplaceAllString(*convertedResult, " ") @@ -672,17 +672,17 @@ func TestThreeEntitiesTwoEntityFilters(t *testing.T) { FILTER e_2.date LIKE "%mei%" FILTER r1._from == e_0._id AND r1._to == e_2._id FILTER length(e_2) != 0 AND length(r1) != 0 - RETURN {"nodes":union_distinct([e_2], []), "rel": union_distinct([r1], [])} + RETURN {"nodes":union_distinct([e_2], []), "rel": union_distinct([r1], []), "mod": union_distinct([], [])} ) FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0 - RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0])} + RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0]), "mod": union_distinct(flatten(e2[**].mod), [])} ) FILTER length(e0) != 0 AND length(e_1) != 0 - RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), [])} + RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), []), "mod": union_distinct(flatten(e0[**].mod), [])} ) -let nodes = union_distinct(flatten(result[**].nodes),[]) -let edges = union_distinct(flatten(result[**].rel),[]) -return {"vertices":nodes,"edges":edges}`) +LET nodes = union_distinct(flatten(result[**].nodes),[]) +LET edges = union_distinct(flatten(result[**].rel),[]) +RETURN {"vertices":nodes,"edges":edges}`) regExCleaner := regexp.MustCompile(`\s+`) correctCleanedResult := regExCleaner.ReplaceAllString(string(correctConvertedResult), " ") convertedCleanedResult := regExCleaner.ReplaceAllString(*convertedResult, " ") @@ -908,23 +908,23 @@ func TestFiveEntitiesFourEntityFilters(t *testing.T) { FILTER e_4.name == "Volkspartij voor Vrijheid en Democratie" FILTER r3._from == e_3._id AND r3._to == e_4._id FILTER length(e_4) != 0 AND length(r3) != 0 - RETURN {"nodes":union_distinct([e_4], []), "rel": union_distinct([r3], [])} + RETURN {"nodes":union_distinct([e_4], []), "rel": union_distinct([r3], []), "mod": union_distinct([], [])} ) FILTER length(e4) != 0 AND length(e_3) != 0 AND length(r2) != 0 - RETURN {"nodes":union_distinct(flatten(e4[**].nodes), [e_3]), "rel": union_distinct(flatten(e4[**].rel), [r2])} + RETURN {"nodes":union_distinct(flatten(e4[**].nodes), [e_3]), "rel": union_distinct(flatten(e4[**].rel), [r2]), "mod": union_distinct(flatten(e4[**].mod), [])} ) FILTER length(e3) != 0 AND length(e_2) != 0 AND length(r1) != 0 - RETURN {"nodes":union_distinct(flatten(e3[**].nodes), [e_2]), "rel": union_distinct(flatten(e3[**].rel), [r1])} + RETURN {"nodes":union_distinct(flatten(e3[**].nodes), [e_2]), "rel": union_distinct(flatten(e3[**].rel), [r1]), "mod": union_distinct(flatten(e3[**].mod), [])} ) FILTER length(e2) != 0 AND length(e_0) != 0 AND length(r0) != 0 - RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0])} + RETURN {"nodes":union_distinct(flatten(e2[**].nodes), [e_0]), "rel": union_distinct(flatten(e2[**].rel), [r0]), "mod": union_distinct(flatten(e2[**].mod), [])} ) FILTER length(e0) != 0 AND length(e_1) != 0 - RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), [])} + RETURN {"nodes":union_distinct(flatten(e0[**].nodes), [e_1]), "rel": union_distinct(flatten(e0[**].rel), []), "mod": union_distinct(flatten(e0[**].mod), [])} ) -let nodes = union_distinct(flatten(result[**].nodes),[]) -let edges = union_distinct(flatten(result[**].rel),[]) -return {"vertices":nodes,"edges":edges}`) +LET nodes = union_distinct(flatten(result[**].nodes),[]) +LET edges = union_distinct(flatten(result[**].rel),[]) +RETURN {"vertices":nodes,"edges":edges}`) regExCleaner := regexp.MustCompile(`\s+`) correctCleanedResult := regExCleaner.ReplaceAllString(string(correctConvertedResult), " ") convertedCleanedResult := regExCleaner.ReplaceAllString(*convertedResult, " ") -- GitLab