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

Function sh_base_battery

tests/repro/repro_grammar_shells.c:129–176  ·  view source on GitHub ↗

── Shared single-file battery: structural base (dims 1-4) ───────────────── * * Four core invariants on valid input, no defs/calls assertions. Used for the * structural-only languages (JANET, DEVICETREE, HYPRLANG). Returns 0 on PASS. */

Source from the content-addressed store, hash-verified

127 * structural-only languages (JANET, DEVICETREE, HYPRLANG). Returns 0 on PASS.
128 */
129static int sh_base_battery(const char *lang_tag, const char *src, CBMLanguage lang,
130 const char *file) {
131 const char *RED = tf_red();
132 const char *RST = tf_reset();
133
134 /* 1. extract-clean */
135 if (inv_extract_clean(src, lang, file) != 1) {
136 printf(" %sFAIL%s [%s] extract-clean: NULL result or has_error set\n",
137 RED, RST, lang_tag);
138 return 1;
139 }
140
141 CBMFileResult *r = inv_rx(src, lang, file);
142 if (!r) {
143 printf(" %sFAIL%s [%s] inv_rx returned NULL after clean extract\n",
144 RED, RST, lang_tag);
145 return 1;
146 }
147
148 int fails = 0;
149
150 /* 2. labels-valid */
151 int bad_labels = inv_count_bad_labels(r);
152 if (bad_labels != 0) {
153 printf(" %sFAIL%s [%s] labels-valid: %d def(s) with invalid label\n",
154 RED, RST, lang_tag, bad_labels);
155 fails++;
156 }
157
158 /* 3. fqn-wellformed */
159 int bad_fqns = inv_count_bad_fqns(r);
160 if (bad_fqns != 0) {
161 printf(" %sFAIL%s [%s] fqn-wellformed: %d def(s) with malformed QN\n",
162 RED, RST, lang_tag, bad_fqns);
163 fails++;
164 }
165
166 /* 4. ranges-valid */
167 int bad_ranges = inv_count_bad_ranges(r);
168 if (bad_ranges != 0) {
169 printf(" %sFAIL%s [%s] ranges-valid: %d def(s) with invalid range\n",
170 RED, RST, lang_tag, bad_ranges);
171 fails++;
172 }
173
174 cbm_free_result(r);
175 return fails ? 1 : 0;
176}
177
178/* ── Shared single-file battery: structural with defs (dims 1-5) ────────────
179 *

Callers 1

Calls 8

tf_redFunction · 0.85
tf_resetFunction · 0.85
inv_extract_cleanFunction · 0.85
inv_rxFunction · 0.85
inv_count_bad_labelsFunction · 0.85
inv_count_bad_fqnsFunction · 0.85
inv_count_bad_rangesFunction · 0.85
cbm_free_resultFunction · 0.85

Tested by

no test coverage detected