Changeset 6a20996
- Timestamp:
- Jan 15, 2013, 8:22:20 AM (12 years ago)
- Branches:
- master, release-1.10
- Children:
- 06e04a9, b7a74a8, bbe7d4a, 9c54979
- Parents:
- 58b6ce5
- git-author:
- Jason Gross <jgross@mit.edu> (07/12/11 10:05:20)
- git-committer:
- Jason Gross <jgross@mit.edu> (01/15/13 08:22:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tester.c
r97cdbaf5 r6a20996 133 133 { 134 134 int numfailed=0; 135 char * s, *path, *home;135 char *path, *home; 136 136 137 137 printf("# BEGIN testing owl_util\n"); … … 229 229 230 230 231 s = owl_util_baseclass("barnowl"); 232 FAIL_UNLESS("baseclass barnowl", !strcmp("barnowl", s)); 233 g_free(s); 234 s = owl_util_baseclass("unbarnowl"); 235 FAIL_UNLESS("baseclass unbarnowl", !strcmp("barnowl", s)); 236 g_free(s); 237 s = owl_util_baseclass("unununbarnowl.d.d"); 238 FAIL_UNLESS("baseclass unununbarnowl.d.d", !strcmp("barnowl", s)); 239 g_free(s); 240 s = owl_util_baseclass("ununun.d.d"); 241 FAIL_UNLESS("baseclass ununun.d.d", !strcmp("", s)); 242 g_free(s); 243 s = owl_util_baseclass("d.d.d.d"); 244 FAIL_UNLESS("baseclass d.d.d.d", !strcmp("d", s)); 245 g_free(s); 246 s = owl_util_baseclass("n.d.d.d"); 247 FAIL_UNLESS("baseclass n.d.d.d", !strcmp("n", s)); 248 g_free(s); 249 s = owl_util_baseclass("ununun."); 250 FAIL_UNLESS("baseclass ununun.", !strcmp(".", s)); 251 g_free(s); 252 s = owl_util_baseclass("unununu"); 253 FAIL_UNLESS("baseclass unununu", !strcmp("u", s)); 254 g_free(s); 255 256 257 s = owl_util_makepath("foo/bar"); 258 FAIL_UNLESS("makepath foo/bar", !strcmp("foo/bar", s)); 259 g_free(s); 260 s = owl_util_makepath("//foo///bar"); 261 FAIL_UNLESS("makepath //foo///bar", !strcmp("/foo/bar", s)); 262 g_free(s); 263 s = owl_util_makepath("foo/~//bar/"); 264 FAIL_UNLESS("makepath foo/~//bar/", !strcmp("foo/~/bar/", s)); 265 g_free(s); 266 s = owl_util_makepath("~thisuserhadreallybetternotexist/foobar/"); 267 FAIL_UNLESS("makepath ~thisuserhadreallybetternotexist/foobar/", 268 !strcmp("~thisuserhadreallybetternotexist/foobar/", s)); 269 g_free(s); 231 CHECK_STR_AND_FREE("baseclass barnowl", 232 "barnowl", owl_util_baseclass("barnowl")); 233 CHECK_STR_AND_FREE("baseclass unbarnowl", 234 "barnowl", owl_util_baseclass("unbarnowl")); 235 CHECK_STR_AND_FREE("baseclass unununbarnowl.d.d", 236 "barnowl", owl_util_baseclass("unununbarnowl.d.d")); 237 CHECK_STR_AND_FREE("baseclass ununun.d.d", 238 "", owl_util_baseclass("ununun.d.d")); 239 CHECK_STR_AND_FREE("baseclass d.d.d.d", 240 "d", owl_util_baseclass("d.d.d.d")); 241 CHECK_STR_AND_FREE("baseclass n.d.d.d", 242 "n", owl_util_baseclass("n.d.d.d")); 243 CHECK_STR_AND_FREE("baseclass ununun.", 244 ".", owl_util_baseclass("ununun.")); 245 CHECK_STR_AND_FREE("baseclass unununu", 246 "u", owl_util_baseclass("unununu")); 247 248 249 CHECK_STR_AND_FREE("makepath foo/bar", 250 "foo/bar", owl_util_makepath("foo/bar")); 251 CHECK_STR_AND_FREE("makepath //foo///bar", 252 "/foo/bar", owl_util_makepath("//foo///bar")); 253 CHECK_STR_AND_FREE("makepath foo/~//bar/", 254 "foo/~/bar/", owl_util_makepath("foo/~//bar/")); 255 CHECK_STR_AND_FREE("makepath ~thisuserhadreallybetternotexist/foobar/", 256 "~thisuserhadreallybetternotexist/foobar/", 257 owl_util_makepath("~thisuserhadreallybetternotexist/foobar/")); 270 258 271 259 home = g_strdup(owl_global_get_homedir(&g)); 272 s = owl_util_makepath("~"); 273 FAIL_UNLESS("makepath ~", !strcmp(home, s)); 274 g_free(s); 260 CHECK_STR_AND_FREE("makepath ~", 261 home, owl_util_makepath("~")); 275 262 276 263 path = g_build_filename(home, "foo/bar/baz", NULL); 277 s = owl_util_makepath("~///foo/bar//baz"); 278 FAIL_UNLESS("makepath ~///foo/bar//baz", !strcmp(path, s)); 279 g_free(s); 264 CHECK_STR_AND_FREE("makepath ~///foo/bar//baz", 265 path, owl_util_makepath("~///foo/bar//baz")); 280 266 g_free(path); 281 267 g_free(home); … … 288 274 } 289 275 290 s = owl_util_makepath("~root"); 291 FAIL_UNLESS("makepath ~root", !strcmp(home, s)); 292 g_free(s); 276 CHECK_STR_AND_FREE("makepath ~root", 277 home, owl_util_makepath("~root")); 293 278 294 279 path = g_build_filename(home, "foo/bar/baz", NULL); 295 s = owl_util_makepath("~root///foo/bar//baz"); 296 FAIL_UNLESS("makepath ~root///foo/bar//baz", !strcmp(path, s)); 297 g_free(s); 280 CHECK_STR_AND_FREE("makepath ~root///foo/bar//baz", 281 path, owl_util_makepath("~root///foo/bar//baz")); 298 282 g_free(path); 299 283 g_free(home);
Note: See TracChangeset
for help on using the changeset viewer.