Changeset dc9665a


Ignore:
Timestamp:
Sep 18, 2010, 3:17:27 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
6425d43
Parents:
f7456bc
git-author:
David Benjamin <davidben@mit.edu> (07/31/10 19:21:57)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 15:17:27)
Message:
Add a test case for owl_fmtext_search
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    rf7456bc rdc9665a  
    528528  owl_free(str);
    529529
     530  /* Test owl_fmtext_search. */
     531  owl_fmtext_clear(&fm1);
     532  owl_fmtext_append_normal(&fm1, "123123123123");
     533  owl_regex_create(&re, "12");
     534  {
     535    int count = 0, offset;
     536    offset = owl_fmtext_search(&fm1, &re, 0);
     537    while (offset >= 0) {
     538      FAIL_UNLESS("search matches",
     539                  !strncmp("12", owl_fmtext_get_text(&fm1) + offset, 2));
     540      count++;
     541      offset = owl_fmtext_search(&fm1, &re, offset+1);
     542    }
     543    FAIL_UNLESS("exactly four matches", count == 4);
     544  }
     545  owl_regex_cleanup(&re);
     546
    530547  /* Test owl_fmtext_line_number. */
    531548  owl_fmtext_clear(&fm1);
Note: See TracChangeset for help on using the changeset viewer.