| 1156 | } |
| 1157 | |
| 1158 | static bool cv2_validate_tests(cv2_context_t *ctx) { |
| 1159 | bool setup = false; |
| 1160 | for (int i = 0; i < ctx->test_count; i++) { |
| 1161 | if (!cv2_step(ctx)) |
| 1162 | return false; |
| 1163 | const cbm_coverage_test_t *row = &ctx->map->tests[i]; |
| 1164 | int suite_order = 1, name_order = 1; |
| 1165 | if (i && !cv2_string_compare(ctx, row[-1].suite, row->suite, &suite_order)) |
| 1166 | return false; |
| 1167 | if (suite_order) { |
| 1168 | if (i && !setup) |
| 1169 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 1170 | setup = false; |
| 1171 | } else { |
| 1172 | if (!cv2_string_compare(ctx, row[-1].name, row->name, &name_order)) |
| 1173 | return false; |
| 1174 | if (!name_order) |
| 1175 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 1176 | } |
| 1177 | if (row->name[0] == '*' && row->name[1] == '\0') |
| 1178 | setup = true; |
| 1179 | } |
| 1180 | if (ctx->test_count && !setup) |
| 1181 | return cv2_fail(ctx, CBM_COVERAGE_PARSE_FORMAT); |
| 1182 | return true; |
| 1183 | } |
| 1184 | |
| 1185 | static bool cv2_hash(cv2_context_t *ctx, cv2_span_t span, char hex[CBM_SHA256_HEX_LEN + 1]) { |
| 1186 | cbm_sha256_ctx hash; |
no test coverage detected