ValidateMapPolicy
Description
Validate whether a given MapPolicy object is valid. Aborts if the policy is structurally invalid.
Parameters
| Name | Direction | Description |
|---|---|---|
policy_value |
in | Policy to validate. |
Success
Continue execution, meaning the policy has a non-empty name, all required callbacks, a non-zero max_probe_count, and first_index / next_index return in-range indices across a fixed set of probe-snapshot inputs.
Failure
abort via LOG_FATAL when any of those invariants is broken (NULL pointer, missing name, missing callback, zero max_probe_count, or a callback returning an index past capacity).
Usage example (Cross-references)
Usage examples (Cross-references)
static bool test_validate_map_policy_without_name_fails(void) {
WriteFmt("Testing ValidateMapPolicy without name\n");
MapPolicy policy = { };
ValidateMapPolicy(policy);
return false;
}
static bool test_validate_map_policy_without_probe_limit_fails(void) {
WriteFmt("Testing ValidateMapPolicy without probe limit\n");
MapPolicy policy = { };
ValidateMapPolicy(policy);
return false;
}- In
Map.Type.c:128:
};
ValidateMapPolicy(custom_policy);
return custom_next_capacity(6, 5, 0, 7) == 10 && custom_first_index(0x55u, 5) < 5 &&
custom_next_index(0x55u, 5, 1, 2) < 5;
Last updated on