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

Function _test_node_creation

tests/unit/test_graph.c:37–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35} EdgeDesc;
36
37void _test_node_creation(Graph *g, size_t node_count) {
38 GrB_Index ncols, nrows, nvals;
39
40 // Create nodes.
41 Node n;
42 for(uint i = 0; i < node_count; i++) {
43 n = GE_NEW_NODE();
44 Graph_CreateNode(g, &n, NULL, 0);
45 }
46
47 // Validate nodes creation.
48 RG_Matrix adj = Graph_GetAdjacencyMatrix(g, false);
49 TEST_ASSERT(RG_Matrix_nrows(&nrows, adj) == GrB_SUCCESS);
50 TEST_ASSERT(RG_Matrix_ncols(&ncols, adj) == GrB_SUCCESS);
51 TEST_ASSERT(RG_Matrix_nvals(&nvals, adj) == GrB_SUCCESS);
52
53 TEST_ASSERT(nvals == 0); // No connection were formed.
54 TEST_ASSERT(ncols >= Graph_NodeCount(g)); // Graph's adjacency matrix dimensions.
55 TEST_ASSERT(nrows >= Graph_NodeCount(g));
56 TEST_ASSERT(Graph_NodeCount(g) == node_count);
57}
58
59/* TODO benchmark functions are currently not invoked */
60void benchmark_node_creation_with_labels() {

Callers 1

test_graphConstructionFunction · 0.85

Calls 6

Graph_CreateNodeFunction · 0.85
Graph_GetAdjacencyMatrixFunction · 0.85
RG_Matrix_nrowsFunction · 0.85
RG_Matrix_ncolsFunction · 0.85
RG_Matrix_nvalsFunction · 0.85
Graph_NodeCountFunction · 0.85

Tested by

no test coverage detected