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

Function _fake_graph_context

tests/unit/test_algebraic_expression.c:64–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62 "MATCH (p:Person)-[ef:friend]->(f:Person)-[ev:visit]->(c:City)-[ew:war]->(e:City) RETURN ew";
63
64static void _fake_graph_context() {
65 GraphContext *gc = (GraphContext *)calloc(1, sizeof(GraphContext));
66
67 gc->g = Graph_New(16, 16);
68
69 gc->ref_count = 1;
70 gc->index_count = 0;
71 gc->graph_name = strdup("G");
72 gc->attributes = raxNew();
73 gc->string_mapping = (char**)array_new(char*, 64);
74 gc->node_schemas = (Schema**)array_new(Schema*, GRAPH_DEFAULT_LABEL_CAP);
75 gc->relation_schemas = (Schema**)array_new(Schema*, GRAPH_DEFAULT_RELATION_TYPE_CAP);
76 gc->queries_log = QueriesLog_New();
77
78 pthread_rwlock_init(&gc->_attribute_rwlock, NULL);
79
80 GraphContext_AddSchema(gc, "Person", SCHEMA_NODE);
81 GraphContext_AddSchema(gc, "City", SCHEMA_NODE);
82 GraphContext_AddSchema(gc, "friend", SCHEMA_EDGE);
83 GraphContext_AddSchema(gc, "visit", SCHEMA_EDGE);
84 GraphContext_AddSchema(gc, "war", SCHEMA_EDGE);
85
86 TEST_ASSERT(QueryCtx_Init());
87 QueryCtx_SetGraphCtx(gc);
88}
89
90/* Create a graph containing:
91 * Entities: 'people' and 'countries'.

Callers 1

setupFunction · 0.70

Calls 5

Graph_NewFunction · 0.85
QueriesLog_NewFunction · 0.85
GraphContext_AddSchemaFunction · 0.85
QueryCtx_InitFunction · 0.85
QueryCtx_SetGraphCtxFunction · 0.85

Tested by

no test coverage detected