| 5632 | } |
| 5633 | |
| 5634 | bool cbm_test_declarations_validate(CBMFileResult *result, |
| 5635 | const cbm_test_declarations_t *declarations) { |
| 5636 | if (!declarations) |
| 5637 | return true; |
| 5638 | for (int i = 0; i < CBM_TEST_PRESET_COUNT; i++) { |
| 5639 | bool enabled = false; |
| 5640 | if (!cbm_test_declarations_preset(declarations, (cbm_test_preset_t)i, &enabled)) |
| 5641 | return tdx_issue(result, CBM_TEST_EXTRACT_UNSUPPORTED_PRESET, -1, 0); |
| 5642 | if (!enabled && i != CBM_TEST_PRESET_C_CBM && i != CBM_TEST_PRESET_GTEST) |
| 5643 | tdx_issue(result, CBM_TEST_EXTRACT_UNSUPPORTED_PRESET, -1, 0); |
| 5644 | } |
| 5645 | int count = 0; |
| 5646 | const cbm_test_declaration_t *items = cbm_test_declarations_items(declarations, &count); |
| 5647 | for (int i = 0; i < count; i++) { |
| 5648 | const cbm_test_declaration_t *rule = &items[i]; |
| 5649 | if (rule->role != CBM_TEST_DECL_CASE && rule->role != CBM_TEST_DECL_SUITE) |
| 5650 | continue; |
| 5651 | if (!tdx_language(rule->language)) |
| 5652 | tdx_issue(result, CBM_TEST_EXTRACT_UNSUPPORTED_LANGUAGE, i, 0); |
| 5653 | if (rule->name_arg_count != 1 || !rule->name_args || rule->name_args[0] < 0) |
| 5654 | tdx_issue(result, CBM_TEST_EXTRACT_UNSUPPORTED_NAME, i, 0); |
| 5655 | } |
| 5656 | return result->test_declarations_status == CBM_TEST_EXTRACT_OK; |
| 5657 | } |
| 5658 | |
| 5659 | static bool tdx_preset(const CBMExtractCtx *ctx, cbm_test_preset_t preset) { |
| 5660 | if (!ctx->test_declarations) |
no test coverage detected