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

Function test_RGMatrix_del

tests/unit/test_rg_matrix.c:311–508  ·  view source on GitHub ↗

multiple delete scenarios

Source from the content-addressed store, hash-verified

309
310// multiple delete scenarios
311void test_RGMatrix_del() {
312 GrB_Type t = GrB_UINT64;
313 RG_Matrix A = NULL;
314 GrB_Matrix M = NULL;
315 GrB_Matrix DP = NULL;
316 GrB_Matrix DM = NULL;
317 GrB_Info info = GrB_SUCCESS;
318 GrB_Index nvals = 0;
319 GrB_Index nrows = 100;
320 GrB_Index ncols = 100;
321 GrB_Index i = 0;
322 GrB_Index j = 1;
323 uint64_t x = 1;
324
325 info = RG_Matrix_new(&A, t, nrows, ncols);
326 TEST_ASSERT(info == GrB_SUCCESS);
327
328 // get internal matrices
329 M = RG_MATRIX_M(A);
330 DP = RG_MATRIX_DELTA_PLUS(A);
331 DM = RG_MATRIX_DELTA_MINUS(A);
332
333 //--------------------------------------------------------------------------
334 // remove none existing entry
335 //--------------------------------------------------------------------------
336
337 info = RG_Matrix_removeElement_UINT64(A, i, j);
338 TEST_ASSERT(info == GrB_NO_VALUE);
339
340 // matrix should not contain any entries in either DP or DM
341 TEST_ASSERT(RG_Matrix_Synced(A));
342
343 //--------------------------------------------------------------------------
344 // remove none flushed addition
345 //--------------------------------------------------------------------------
346
347 // set element at position i,j
348 info = RG_Matrix_setElement_UINT64(A, x, i, j);
349 TEST_ASSERT(info == GrB_SUCCESS);
350
351 // remove element at position i,j
352 info = RG_Matrix_removeElement_UINT64(A, i, j);
353 TEST_ASSERT(info == GrB_SUCCESS);
354
355 // matrix should be mark as dirty
356 TEST_ASSERT(RG_Matrix_isDirty(A));
357
358 //--------------------------------------------------------------------------
359 // validations
360 //--------------------------------------------------------------------------
361
362 // A should be empty
363 RG_Matrix_nvals(&nvals, A);
364 TEST_ASSERT(nvals == 0);
365
366 // M should be empty
367 M_EMPTY();
368

Callers

nothing calls this directly

Calls 9

RG_Matrix_newFunction · 0.85
RG_Matrix_SyncedFunction · 0.85
RG_Matrix_isDirtyFunction · 0.85
RG_Matrix_nvalsFunction · 0.85
RG_Matrix_waitFunction · 0.85
RG_Matrix_freeFunction · 0.85

Tested by

no test coverage detected