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

Function test_getNode

tests/unit/test_graph.c:326–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326void test_getNode() {
327 /* Create a graph with nodeCount nodes,
328 * Make sure node retrival works as expected:
329 * try to get nodes (0 - nodeCount) */
330
331 Node n;
332 size_t nodeCount = 16;
333 Graph *g = Graph_New(nodeCount, nodeCount);
334
335 Graph_AcquireWriteLock(g);
336 {
337 for(int i = 0 ; i < nodeCount; i++) {
338 n = GE_NEW_NODE();
339 Graph_CreateNode(g, &n, NULL, 0);
340 }
341 }
342 Graph_ReleaseLock(g);
343
344 // Get nodes 0 - nodeCount.
345 NodeID i = 0;
346 for(; i < nodeCount; i++) {
347 Graph_GetNode(g, i, &n);
348 TEST_ASSERT(n.attributes != NULL);
349 }
350
351 Graph_Free(g);
352}
353
354void test_getEdge() {
355 /* Create a graph with both nodes and edges.

Callers

nothing calls this directly

Calls 6

Graph_NewFunction · 0.85
Graph_AcquireWriteLockFunction · 0.85
Graph_CreateNodeFunction · 0.85
Graph_ReleaseLockFunction · 0.85
Graph_GetNodeFunction · 0.85
Graph_FreeFunction · 0.85

Tested by

no test coverage detected