Establish the routing contract using complete byte spans, including NUL. * Own imports are local; changes to a declared base can affect other files. */
| 605 | /* Establish the routing contract using complete byte spans, including NUL. |
| 606 | * Own imports are local; changes to a declared base can affect other files. */ |
| 607 | static bool dm_control_delta(const char *before, int before_length, const char *after, |
| 608 | int after_length, int expected, const char *label) { |
| 609 | CBMFileResult *a = |
| 610 | cbm_extract_file(before, before_length, CBM_LANG_CSHARP, "p", "Bad.cs", 0, NULL, NULL); |
| 611 | CBMFileResult *b = |
| 612 | cbm_extract_file(after, after_length, CBM_LANG_CSHARP, "p", "Bad.cs", 0, NULL, NULL); |
| 613 | char *pa = a && a->doc_scope ? cbm_doclink_portable_scope(a->doc_scope) : NULL; |
| 614 | char *pb = b && b->doc_scope ? cbm_doclink_portable_scope(b->doc_scope) : NULL; |
| 615 | dm_names_t names = {{0}}; |
| 616 | int delta = |
| 617 | pa && pb ? cbm_doclinks_scope_delta(pa, pb, dm_name_put, &names) : DM_DELTA_SCAN_FAILED; |
| 618 | bool changed = pa && pb && strcmp(pa, pb) != 0; |
| 619 | bool correct = changed && delta == expected; |
| 620 | fprintf(stderr, "doc control delta case=%s changed=%d delta=%d expected=%d correct=%d\n", label, |
| 621 | changed, delta, expected, correct); |
| 622 | cbm_free(CBM_MEM_CLASS_OTHER, pa); |
| 623 | cbm_free(CBM_MEM_CLASS_OTHER, pb); |
| 624 | if (a) { |
| 625 | cbm_free_result(a); |
| 626 | } |
| 627 | if (b) { |
| 628 | cbm_free_result(b); |
| 629 | } |
| 630 | return correct; |
| 631 | } |
| 632 | |
| 633 | TEST(doc_mentions_cs_control_scopes) { |
| 634 | static const unsigned bytes[] = {0, 1, 127, 32}; |
no test coverage detected