Skip to content

Commit 3939e16

Browse files
committed
Update to add failure message in check_equivalence
1 parent 1fb9edc commit 3939e16

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

examples/check_equivalence.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,53 +138,62 @@ int main(int argc, char** argv) {
138138
fprintf(stderr, "Formats do not match. (%s != %s)\n",
139139
bsp_get_matrix_format_string(matrix1.format),
140140
bsp_get_matrix_format_string(matrix2.format));
141+
fprintf(stderr, "FAIL!\n");
141142
return 1;
142143
}
143144

144145
if (matrix1.structure != matrix2.structure) {
145146
fprintf(stderr, "Structures do not match. (%s != %s)\n",
146147
bsp_get_structure_string(matrix1.structure),
147148
bsp_get_structure_string(matrix2.structure));
149+
fprintf(stderr, "FAIL!\n");
148150
return 2;
149151
}
150152

151153
if (matrix1.nrows != matrix2.nrows || matrix1.ncols != matrix2.ncols) {
152154
fprintf(stderr, "Dimensions do not match. (%zu, %zu) != (%zu, %zu)\n",
153155
matrix1.nrows, matrix1.ncols, matrix2.nrows, matrix2.ncols);
156+
fprintf(stderr, "FAIL!\n");
154157
return 3;
155158
}
156159

157160
if (matrix1.nnz != matrix2.nnz) {
158161
fprintf(stderr, "Number of stored values does not match. %zu != %zu\n",
159162
matrix1.nnz, matrix2.nnz);
163+
fprintf(stderr, "FAIL!\n");
160164
return 4;
161165
}
162166

163167
if (matrix1.is_iso != matrix2.is_iso) {
164168
fprintf(stderr, "ISO-ness does not match. %s != %s\n",
165169
(matrix1.is_iso) ? "true" : "false",
166170
(matrix2.is_iso) ? "true" : "false");
171+
fprintf(stderr, "FAIL!\n");
167172
return 5;
168173
}
169174

170175
if (check_array_equivalence(matrix1.values, matrix2.values) != 0) {
171176
fprintf(stderr, "Value arrays not equivalent.\n");
177+
fprintf(stderr, "FAIL!\n");
172178
return 6;
173179
}
174180

175181
if (check_array_equivalence(matrix1.indices_0, matrix2.indices_0) != 0) {
176182
fprintf(stderr, "Indices_0 arrays not equivalent.\n");
183+
fprintf(stderr, "FAIL!\n");
177184
return 7;
178185
}
179186

180187
if (check_array_equivalence(matrix1.indices_1, matrix2.indices_1) != 0) {
181188
fprintf(stderr, "Indices_1 arrays not equivalent.\n");
189+
fprintf(stderr, "FAIL!\n");
182190
return 8;
183191
}
184192

185193
if (check_array_equivalence(matrix1.pointers_to_1, matrix2.pointers_to_1) !=
186194
0) {
187195
fprintf(stderr, "Pointers_to_1 arrays not equivalent.\n");
196+
fprintf(stderr, "FAIL!\n");
188197
return 9;
189198
}
190199

0 commit comments

Comments
 (0)