(text, function)
| 271 | |
| 272 | |
| 273 | def exact_positive_count(text, function): |
| 274 | blocks = [] |
| 275 | current = None |
| 276 | for line in text.splitlines(): |
| 277 | heading = re.fullmatch(r" (.+):", line) |
| 278 | if heading: |
| 279 | current = {"name": heading.group(1), "counts": []} |
| 280 | blocks.append(current) |
| 281 | elif current is not None: |
| 282 | count = re.fullmatch(r" Function count: ([0-9]+)", line) |
| 283 | if count: |
| 284 | current["counts"].append(int(count.group(1))) |
| 285 | exact = [block for block in blocks if block["name"] == function] |
| 286 | if len(exact) != 1 or len(exact[0]["counts"]) != 1 or exact[0]["counts"][0] <= 0: |
| 287 | raise Infrastructure("exact child-only function lacks one positive native count: " + function) |
| 288 | return exact[0]["counts"][0] |
| 289 | |
| 290 | |
| 291 | def profile_controls(case, suite_dir, tool, environment, witnesses): |
no test coverage detected