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

Function test_newGraph

tests/unit/test_graph.c:225–247  ·  view source on GitHub ↗

Validate the creation of a graph, Make sure graph's defaults are applied.

Source from the content-addressed store, hash-verified

223// Validate the creation of a graph,
224// Make sure graph's defaults are applied.
225void test_newGraph() {
226 GrB_Index ncols, nrows, nvals;
227 Graph *g = Graph_New(GRAPH_DEFAULT_NODE_CAP, GRAPH_DEFAULT_EDGE_CAP);
228 Graph_AcquireWriteLock(g);
229 RG_Matrix adj_matrix = g->adjacency_matrix;
230 TEST_ASSERT(RG_Matrix_ncols(&ncols, adj_matrix) == GrB_SUCCESS);
231 TEST_ASSERT(RG_Matrix_nrows(&nrows, adj_matrix) == GrB_SUCCESS);
232 TEST_ASSERT(RG_Matrix_nvals(&nvals, adj_matrix) == GrB_SUCCESS);
233
234 TEST_ASSERT(g->nodes != NULL);
235 TEST_ASSERT(g->relations != NULL);
236 TEST_ASSERT(g->labels != NULL);
237 TEST_ASSERT(g->adjacency_matrix != NULL);
238 TEST_ASSERT(Graph_NodeCount(g) == 0);
239
240 GrB_Index n = Graph_RequiredMatrixDim(g);
241 TEST_ASSERT(nrows == n);
242 TEST_ASSERT(ncols == n);
243 TEST_ASSERT(nvals == 0);
244
245 Graph_ReleaseLock(g);
246 Graph_Free(g);
247}
248
249// Tests node and edge creation.
250void test_graphConstruction() {

Callers

nothing calls this directly

Calls 9

Graph_NewFunction · 0.85
Graph_AcquireWriteLockFunction · 0.85
RG_Matrix_ncolsFunction · 0.85
RG_Matrix_nrowsFunction · 0.85
RG_Matrix_nvalsFunction · 0.85
Graph_NodeCountFunction · 0.85
Graph_RequiredMatrixDimFunction · 0.85
Graph_ReleaseLockFunction · 0.85
Graph_FreeFunction · 0.85

Tested by

no test coverage detected