MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / gic_bad_span

Function gic_bad_span

tests/test_gitignore_checked.c:208–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208static bool gic_bad_span(cbm_ignore_checked_t *owner, const cbm_ignore_program_t *old_program,
209 unsigned kind) {
210 cbm_ignore_checked_usage_t before, after;
211 if (!cbm_ignore_checked_usage(owner, &before))
212 return false;
213 cbm_ignore_checked_control_t control = gic_control();
214 cbm_ignore_checked_error_t error;
215 cbm_ignore_checked_status_t status;
216 if (kind == 0) {
217 const unsigned char input[] = {'x', '\n', 0, 'y'};
218 cbm_ignore_checked_parse_result_t out = {.program = old_program, .pattern_count = 77};
219 status = cbm_ignore_checked_parse(owner, input, sizeof(input), &control, &out, &error);
220 if (out.program || out.pattern_count)
221 return false;
222 } else {
223 const char missing[] = {'x', 'y'};
224 const char embedded[] = {'x', 0, 'y', 0};
225 cbm_ignore_decision_t decision = CBM_IGNORE_IGNORED;
226 status = cbm_ignore_checked_match(owner, old_program, kind == 1 ? missing : embedded,
227 kind == 1 ? 1 : 3, false, &control, &decision, &error);
228 if (decision != CBM_IGNORE_UNAVAILABLE)
229 return false;
230 }
231 uint64_t reserved = kind == 1 ? 2 : 4;
232 return cbm_ignore_checked_usage(owner, &after) &&
233 after.bytes_reserved == before.bytes_reserved + reserved &&
234 gic_status(status, CBM_IGNORE_CHECKED_UNSUPPORTED, &error) &&
235 gic_terminal(owner, old_program, CBM_IGNORE_CHECKED_UNSUPPORTED);
236}
237
238TEST(gic_b_exact_spans_and_input_lifetime) {
239 gic_fixture f;

Callers 1

Calls 6

cbm_ignore_checked_usageFunction · 0.85
gic_controlFunction · 0.85
cbm_ignore_checked_parseFunction · 0.85
cbm_ignore_checked_matchFunction · 0.85
gic_statusFunction · 0.85
gic_terminalFunction · 0.85

Tested by

no test coverage detected