`coverage`: what a recorded coverage map depends on beyond the code it * measures. Strict on keys: an ignored misspelling would make admitting a map * easier, never harder. */
| 746 | * measures. Strict on keys: an ignored misspelling would make admitting a map |
| 747 | * easier, never harder. */ |
| 748 | static bool tp_parse_coverage(cbm_test_policy_t *policy, yyjson_val *coverage) { |
| 749 | bool valid = true; |
| 750 | yyjson_val *paths = tp_field(coverage, "compatibility_paths", &valid); |
| 751 | if (!valid || yyjson_obj_size(coverage) != (paths ? 1U : 0U) || |
| 752 | (paths && !yyjson_is_arr(paths))) |
| 753 | return false; |
| 754 | size_t count = paths ? yyjson_arr_size(paths) : 0; |
| 755 | if (count > TP_MAX_COMPAT_PATHS) |
| 756 | return false; |
| 757 | policy->compat_paths = |
| 758 | cbm_arena_calloc(&policy->arena, (count ? count : 1) * sizeof(*policy->compat_paths)); |
| 759 | if (!policy->compat_paths) |
| 760 | return false; |
| 761 | size_t index, maximum; |
| 762 | yyjson_val *path; |
| 763 | yyjson_arr_foreach(paths, index, maximum, path) { |
| 764 | size_t len = 0; |
| 765 | const char *text = tp_string(path, &len); |
| 766 | if (!tp_relative_path(text, len)) |
| 767 | return false; |
| 768 | policy->compat_paths[index] = cbm_arena_strdup(&policy->arena, text); |
| 769 | if (!policy->compat_paths[index]) |
| 770 | return false; |
| 771 | } |
| 772 | policy->compat_count = (int)count; |
| 773 | return true; |
| 774 | } |
| 775 | |
| 776 | static bool tp_parse_policy(cbm_test_policy_t *policy, yyjson_val *impact) { |
| 777 | bool valid = true; |
no test coverage detected