test exporting RG_Matrix to GrB_Matrix when there are no pending changes by exporting the matrix after flushing
| 1157 | // test exporting RG_Matrix to GrB_Matrix when there are no pending changes |
| 1158 | // by exporting the matrix after flushing |
| 1159 | void test_RGMatrix_export_no_changes() { |
| 1160 | GrB_Type t = GrB_BOOL; |
| 1161 | RG_Matrix A = NULL; |
| 1162 | GrB_Matrix M = NULL; |
| 1163 | GrB_Matrix N = NULL; // exported matrix |
| 1164 | GrB_Info info = GrB_SUCCESS; |
| 1165 | GrB_Index i = 0; |
| 1166 | GrB_Index j = 1; |
| 1167 | GrB_Index nrows = 100; |
| 1168 | GrB_Index ncols = 100; |
| 1169 | bool sync = false; |
| 1170 | |
| 1171 | info = RG_Matrix_new(&A, t, nrows, ncols); |
| 1172 | TEST_ASSERT(info == GrB_SUCCESS); |
| 1173 | |
| 1174 | // get internal matrices |
| 1175 | M = RG_MATRIX_M(A); |
| 1176 | |
| 1177 | //-------------------------------------------------------------------------- |
| 1178 | // export empty matrix |
| 1179 | //-------------------------------------------------------------------------- |
| 1180 | |
| 1181 | info = RG_Matrix_export(&N, A); |
| 1182 | TEST_ASSERT(info == GrB_SUCCESS); |
| 1183 | |
| 1184 | //-------------------------------------------------------------------------- |
| 1185 | // validation |
| 1186 | //-------------------------------------------------------------------------- |
| 1187 | |
| 1188 | ASSERT_GrB_Matrices_EQ(M, N); |
| 1189 | GrB_Matrix_free(&N); |
| 1190 | |
| 1191 | //-------------------------------------------------------------------------- |
| 1192 | // export none empty matrix |
| 1193 | //-------------------------------------------------------------------------- |
| 1194 | |
| 1195 | // set element at position i,j |
| 1196 | info = RG_Matrix_setElement_BOOL(A, i, j); |
| 1197 | TEST_ASSERT(info == GrB_SUCCESS); |
| 1198 | |
| 1199 | //-------------------------------------------------------------------------- |
| 1200 | // flush matrix, sync |
| 1201 | //-------------------------------------------------------------------------- |
| 1202 | |
| 1203 | // wait, force sync |
| 1204 | sync = true; |
| 1205 | RG_Matrix_wait(A, sync); |
| 1206 | |
| 1207 | //-------------------------------------------------------------------------- |
| 1208 | // validation |
| 1209 | //-------------------------------------------------------------------------- |
| 1210 | |
| 1211 | info = RG_Matrix_export(&N, A); |
| 1212 | TEST_ASSERT(info == GrB_SUCCESS); |
| 1213 | |
| 1214 | ASSERT_GrB_Matrices_EQ(M, N); |
| 1215 | |
| 1216 | //-------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected