Validate the creation of a graph, Make sure graph's defaults are applied.
| 223 | // Validate the creation of a graph, |
| 224 | // Make sure graph's defaults are applied. |
| 225 | void 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. |
| 250 | void test_graphConstruction() { |
nothing calls this directly
no test coverage detected