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

Function test_RGMatrix_flus

tests/unit/test_rg_matrix.c:775–841  ·  view source on GitHub ↗

flush simple addition

Source from the content-addressed store, hash-verified

773
774// flush simple addition
775void test_RGMatrix_flus() {
776 GrB_Type t = GrB_BOOL;
777 RG_Matrix A = NULL;
778 GrB_Matrix M = NULL;
779 GrB_Matrix DP = NULL;
780 GrB_Matrix DM = NULL;
781 GrB_Info info = GrB_SUCCESS;
782 GrB_Index nvals = 0;
783 GrB_Index nrows = 100;
784 GrB_Index ncols = 100;
785 GrB_Index i = 0;
786 GrB_Index j = 1;
787 bool sync = false;
788
789 info = RG_Matrix_new(&A, t, nrows, ncols);
790 TEST_ASSERT(info == GrB_SUCCESS);
791
792 // set element at position i,j
793 info = RG_Matrix_setElement_BOOL(A, i, j);
794 TEST_ASSERT(info == GrB_SUCCESS);
795
796 // get internal matrices
797 M = RG_MATRIX_M(A);
798 DP = RG_MATRIX_DELTA_PLUS(A);
799 DM = RG_MATRIX_DELTA_MINUS(A);
800
801 //--------------------------------------------------------------------------
802 // flush matrix, no sync
803 //--------------------------------------------------------------------------
804
805 // wait, don't force sync
806 sync = false;
807 RG_Matrix_wait(A, sync);
808
809 // M should be empty
810 M_EMPTY();
811
812 // DM should be empty
813 DM_EMPTY();
814
815 // DP should contain a single element
816 DP_NOT_EMPTY();
817
818 //--------------------------------------------------------------------------
819 // flush matrix, sync
820 //--------------------------------------------------------------------------
821
822 // wait, force sync
823 sync = true;
824 RG_Matrix_wait(A, sync);
825
826 RG_Matrix_nvals(&nvals, A);
827 TEST_ASSERT(nvals == 1);
828
829 // M should be empty
830 M_NOT_EMPTY();
831
832 // DM should be empty

Callers

nothing calls this directly

Calls 5

RG_Matrix_newFunction · 0.85
RG_Matrix_waitFunction · 0.85
RG_Matrix_nvalsFunction · 0.85
RG_Matrix_freeFunction · 0.85

Tested by

no test coverage detected