comparison tests.c @ 649:2c9260f5cf44

Tweedle.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 25 Jan 2020 11:35:59 +0200
parents 1e7e3f96632e
children 24cbab6e88c6
comparison
equal deleted inserted replaced
648:91c43398c6fc 649:2c9260f5cf44
607 THERR("Regex compilation failed: %s\n", 607 THERR("Regex compilation failed: %s\n",
608 th_error_str(res)); 608 th_error_str(res));
609 goto out; 609 goto out;
610 } 610 }
611 611
612 th_regex_dump(stdout, 1, expr); 612 if (th_verbosity > 0)
613 th_regex_dump(stdout, 1, expr);
613 614
614 for (const test_regex_def1 *def = list; def->str != NULL; def++) 615 for (const test_regex_def1 *def = list; def->str != NULL; def++)
615 { 616 {
616 th_regex_match_t *matches = NULL; 617 th_regex_match_t *matches = NULL;
617 size_t nmatches; 618 size_t nmatches;
636 637
637 out: 638 out:
638 th_regex_free(expr); 639 th_regex_free(expr);
639 } 640 }
640 641
642
641 void test_regex_list2(const test_regex_def2 *list) 643 void test_regex_list2(const test_regex_def2 *list)
642 { 644 {
643 printf("========================================\n"); 645 printf("========================================\n");
644 646
645 for (const test_regex_def2 *def = list; def->str != NULL; def++) 647 for (const test_regex_def2 *def = list; def->str != NULL; def++)
655 THERR("Regex compilation failed: %s\n", 657 THERR("Regex compilation failed: %s\n",
656 th_error_str(res)); 658 th_error_str(res));
657 goto out; 659 goto out;
658 } 660 }
659 661
660 th_regex_dump(stdout, 1, expr); 662 if (th_verbosity > 0)
663 th_regex_dump(stdout, 1, expr);
661 664
662 printf("----------------------------------------\n"); 665 printf("----------------------------------------\n");
663 666
664 if ((res = th_regex_match(expr, def->str, 667 if ((res = th_regex_match(expr, def->str,
665 &nmatches, &matches, -1, def->flags)) != THERR_OK) 668 &nmatches, &matches, -1, def->flags)) != THERR_OK)