| 705 | } |
| 706 | |
| 707 | void test_RGMatrix_set() { |
| 708 | GrB_Type t = GrB_BOOL; |
| 709 | RG_Matrix A = NULL; |
| 710 | GrB_Matrix M = NULL; |
| 711 | GrB_Matrix DP = NULL; |
| 712 | GrB_Matrix DM = NULL; |
| 713 | GrB_Info info = GrB_SUCCESS; |
| 714 | GrB_Index nvals = 0; |
| 715 | GrB_Index nrows = 100; |
| 716 | GrB_Index ncols = 100; |
| 717 | GrB_Index i = 0; |
| 718 | GrB_Index j = 1; |
| 719 | |
| 720 | info = RG_Matrix_new(&A, t, nrows, ncols); |
| 721 | TEST_ASSERT(info == GrB_SUCCESS); |
| 722 | |
| 723 | // get internal matrices |
| 724 | M = RG_MATRIX_M(A); |
| 725 | DP = RG_MATRIX_DELTA_PLUS(A); |
| 726 | DM = RG_MATRIX_DELTA_MINUS(A); |
| 727 | |
| 728 | //-------------------------------------------------------------------------- |
| 729 | // Set element that marked for deletion |
| 730 | //-------------------------------------------------------------------------- |
| 731 | |
| 732 | // set element at position i,j |
| 733 | info = RG_Matrix_setElement_BOOL(A, i, j); |
| 734 | TEST_ASSERT(info == GrB_SUCCESS); |
| 735 | |
| 736 | // force sync |
| 737 | // entry should migrated from 'delta-plus' to 'M' |
| 738 | RG_Matrix_wait(A, true); |
| 739 | |
| 740 | // set element at position i,j |
| 741 | info = RG_Matrix_removeElement_BOOL(A, i, j); |
| 742 | TEST_ASSERT(info == GrB_SUCCESS); |
| 743 | |
| 744 | // set element at position i,j |
| 745 | info = RG_Matrix_setElement_BOOL(A, i, j); |
| 746 | TEST_ASSERT(info == GrB_SUCCESS); |
| 747 | |
| 748 | //-------------------------------------------------------------------------- |
| 749 | // validations |
| 750 | //-------------------------------------------------------------------------- |
| 751 | |
| 752 | // A should be empty |
| 753 | RG_Matrix_nvals(&nvals, A); |
| 754 | TEST_ASSERT(nvals == 1); |
| 755 | |
| 756 | // M should contain a single element |
| 757 | M_NOT_EMPTY(); |
| 758 | |
| 759 | // DM should contain a single element |
| 760 | DM_EMPTY(); |
| 761 | |
| 762 | // DP should be empty |
| 763 | DP_EMPTY(); |
| 764 |
nothing calls this directly
no test coverage detected