Changeset a04218c
- Timestamp:
- Oct 23, 2010, 3:18:16 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- eaedfba
- Parents:
- 7d7326c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tester.c
rac6d4e4 ra04218c 128 128 printf("# BEGIN testing owl_util\n"); 129 129 130 FAIL_UNLESS("owl_util_substitute 1", 131 !strcmp("foo", owl_text_substitute("foo", "", "Y"))); 132 FAIL_UNLESS("owl_text_substitute 2", 133 !strcmp("fYZYZ", owl_text_substitute("foo", "o", "YZ"))); 134 FAIL_UNLESS("owl_text_substitute 3", 135 !strcmp("foo", owl_text_substitute("fYZYZ", "YZ", "o"))); 136 FAIL_UNLESS("owl_text_substitute 4", 137 !strcmp("/u/foo/meep", owl_text_substitute("~/meep", "~", "/u/foo"))); 130 #define CHECK_STR_AND_FREE(desc, expected, expr) \ 131 do { \ 132 char *__value = (expr); \ 133 FAIL_UNLESS((desc), !strcmp((expected), __value)); \ 134 owl_free(__value); \ 135 } while (0) 136 137 CHECK_STR_AND_FREE("owl_util_substitute 1", "foo", 138 owl_text_substitute("foo", "", "Y")); 139 CHECK_STR_AND_FREE("owl_text_substitute 2", "fYZYZ", 140 owl_text_substitute("foo", "o", "YZ")); 141 CHECK_STR_AND_FREE("owl_text_substitute 3", "foo", 142 owl_text_substitute("fYZYZ", "YZ", "o")); 143 CHECK_STR_AND_FREE("owl_text_substitute 4", "/u/foo/meep", 144 owl_text_substitute("~/meep", "~", "/u/foo")); 138 145 139 146 FAIL_UNLESS("skiptokens 1", … … 142 149 !strcmp("meep", skiptokens("foo 'bar quux' meep", 2))); 143 150 144 FAIL_UNLESS("expand_tabs 1", 145 !strcmp(" hi", owl_text_expand_tabs("\thi"))); 146 147 FAIL_UNLESS("expand_tabs 2", 148 !strcmp(" hi\nword tab", owl_text_expand_tabs("\thi\nword\ttab"))); 149 150 FAIL_UNLESS("expand_tabs 3", 151 !strcmp(" 2 tabs", owl_text_expand_tabs("\t\t2 tabs"))); 152 FAIL_UNLESS("expand_tabs 4", 153 !strcmp("α ααααααα! ", owl_text_expand_tabs("α\tααααααα!\t"))); 154 FAIL_UNLESS("expand_tabs 5", 155 !strcmp("A AAA!! ", owl_text_expand_tabs("A\tAAA!!\t"))); 151 CHECK_STR_AND_FREE("expand_tabs 1", " hi", owl_text_expand_tabs("\thi")); 152 153 CHECK_STR_AND_FREE("expand_tabs 2", " hi\nword tab", 154 owl_text_expand_tabs("\thi\nword\ttab")); 155 156 CHECK_STR_AND_FREE("expand_tabs 3", " 2 tabs", 157 owl_text_expand_tabs("\t\t2 tabs")); 158 CHECK_STR_AND_FREE("expand_tabs 4", "α ααααααα! ", 159 owl_text_expand_tabs("α\tααααααα!\t")); 160 CHECK_STR_AND_FREE("expand_tabs 5", "A AAA!! ", 161 owl_text_expand_tabs("A\tAAA!!\t")); 156 162 157 163 FAIL_UNLESS("skiptokens 1",
Note: See TracChangeset
for help on using the changeset viewer.