MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / test_ShareableEntity

Function test_ShareableEntity

tests/unit/test_algebraic_expression.c:1191–1461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1189}
1190
1191void test_ShareableEntity() {
1192 const char *q =
1193 "MATCH (p:Person)-[ef:friend]->(f:Person) MATCH (f:Person)-[ev:visit]->(c:City)-[ew:war]->(e:City) RETURN p,e";
1194 AST *master_ast;
1195 AlgebraicExpression **actual = build_algebraic_expression(q, &master_ast);
1196 uint exp_count = array_len(actual);
1197 TEST_ASSERT(exp_count == 1);
1198
1199 AlgebraicExpression *expected[8];
1200 expected[0] = AlgebraicExpression_FromString("p*F*f*V*c*W*e", _matrices);
1201 compare_algebraic_expressions(actual, expected, 1);
1202
1203 // Clean up.
1204 free_algebraic_expressions(actual, exp_count);
1205 free_algebraic_expressions(expected, exp_count);
1206 array_free(actual);
1207 AST_Free(master_ast);
1208
1209 exp_count = 0;
1210 q = "MATCH (p:Person)-[ef:friend]->(f:Person) MATCH (f:Person)<-[ev:visit]-(c:City)<-[ew:war]-(e:City) RETURN p,e";
1211 actual = build_algebraic_expression(q, &master_ast);
1212 exp_count = array_len(actual);
1213 TEST_ASSERT(exp_count == 1);
1214
1215 expected[0] = AlgebraicExpression_FromString("e*W*c*V*f*tF*p", _matrices);
1216 compare_algebraic_expressions(actual, expected, 1);
1217
1218 // Clean up.
1219 free_algebraic_expressions(actual, exp_count);
1220 free_algebraic_expressions(expected, exp_count);
1221 array_free(actual);
1222 AST_Free(master_ast);
1223
1224 exp_count = 0;
1225 q = "MATCH (p:Person)-[ef:friend]->(f:Person) MATCH (f:Person)-[ev:visit]->(c:City) MATCH (c:City)-[ew:war]->(e:City) RETURN p,e";
1226 actual = build_algebraic_expression(q, &master_ast);
1227 exp_count = array_len(actual);
1228 TEST_ASSERT(exp_count == 1);
1229
1230 expected[0] = AlgebraicExpression_FromString("p*F*f*V*c*W*e", _matrices);
1231 compare_algebraic_expressions(actual, expected, 1);
1232
1233 // Clean up.
1234 free_algebraic_expressions(actual, exp_count);
1235 free_algebraic_expressions(expected, exp_count);
1236 array_free(actual);
1237 AST_Free(master_ast);
1238
1239 exp_count = 0;
1240 q = "MATCH (a:Person)-[:friend]->(f:Person) MATCH (b:Person)-[:friend]->(f:Person) RETURN a,b";
1241 actual = build_algebraic_expression(q, &master_ast);
1242 exp_count = array_len(actual);
1243 TEST_ASSERT(exp_count == 1);
1244
1245 expected[0] = AlgebraicExpression_FromString("p*F*p*tF*p", _matrices);
1246 compare_algebraic_expressions(actual, expected, 1);
1247
1248 // Clean up.

Callers

nothing calls this directly

Calls 7

array_lenFunction · 0.85
array_freeFunction · 0.85
AST_FreeFunction · 0.85

Tested by

no test coverage detected