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

Function test_RGMatrix_copy

tests/unit/test_rg_matrix.c:1296–1370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1294}
1295
1296void test_RGMatrix_copy() {
1297 GrB_Type t = GrB_BOOL;
1298 RG_Matrix A = NULL;
1299 RG_Matrix B = NULL;
1300 GrB_Matrix A_M = NULL;
1301 GrB_Matrix B_M = NULL;
1302 GrB_Matrix A_DP = NULL;
1303 GrB_Matrix B_DP = NULL;
1304 GrB_Matrix A_DM = NULL;
1305 GrB_Matrix B_DM = NULL;
1306 GrB_Info info = GrB_SUCCESS;
1307 GrB_Index nrows = 100;
1308 GrB_Index ncols = 100;
1309 bool sync = false;
1310
1311 info = RG_Matrix_new(&A, t, nrows, ncols);
1312 TEST_ASSERT(info == GrB_SUCCESS);
1313
1314 info = RG_Matrix_new(&B, t, nrows, ncols);
1315 TEST_ASSERT(info == GrB_SUCCESS);
1316
1317 // set elements
1318 info = RG_Matrix_setElement_BOOL(A, 0, 0);
1319 TEST_ASSERT(info == GrB_SUCCESS);
1320 info = RG_Matrix_setElement_BOOL(A, 1, 1);
1321 TEST_ASSERT(info == GrB_SUCCESS);
1322
1323 //--------------------------------------------------------------------------
1324 // flush matrix, sync
1325 //--------------------------------------------------------------------------
1326
1327 // wait, force sync
1328 sync = true;
1329 RG_Matrix_wait(A, sync);
1330
1331 //--------------------------------------------------------------------------
1332 // set pending changes
1333 //--------------------------------------------------------------------------
1334
1335 // remove element at position 0,0
1336 info = RG_Matrix_removeElement_BOOL(A, 0, 0);
1337 TEST_ASSERT(info == GrB_SUCCESS);
1338
1339 // set element at position 2,2
1340 info = RG_Matrix_setElement_BOOL(A, 2, 2);
1341 TEST_ASSERT(info == GrB_SUCCESS);
1342
1343 //--------------------------------------------------------------------------
1344 // copy matrix
1345 //--------------------------------------------------------------------------
1346
1347 info = RG_Matrix_copy(B, A);
1348 TEST_ASSERT(info == GrB_SUCCESS);
1349
1350 //--------------------------------------------------------------------------
1351 // validation
1352 //--------------------------------------------------------------------------
1353

Callers

nothing calls this directly

Calls 7

RG_Matrix_newFunction · 0.85
RG_Matrix_waitFunction · 0.85
RG_Matrix_copyFunction · 0.85
ASSERT_GrB_Matrices_EQFunction · 0.85
RG_Matrix_freeFunction · 0.85

Tested by

no test coverage detected