Changes in tester.c [3f6555d:4123da1]
Legend:
- Unmodified
- Added
- Removed
-
tester.c
r3f6555d r4123da1 16 16 int main(int argc, char **argv, char **env) 17 17 { 18 /* initialize a fake ncurses, detached from std{in,out} */ 19 FILE *rnull = fopen("/dev/null", "r"); 20 FILE *wnull = fopen("/dev/null", "w"); 21 newterm("xterm", wnull, rnull); 22 /* initialize global structures */ 23 owl_global_init(&g); 18 owl_errqueue_init(owl_global_get_errqueue(&g)); 19 owl_obarray_init(&(g.obarray)); 20 g.context_stack = NULL; 21 owl_global_push_context(&g, OWL_CTX_STARTUP, NULL, NULL); 24 22 25 23 numtests = 0; … … 33 31 numfailures += owl_variable_regtest(); 34 32 numfailures += owl_filter_regtest(); 33 numfailures += owl_obarray_regtest(); 35 34 numfailures += owl_editwin_regtest(); 36 35 if (numfailures) { … … 38 37 } 39 38 printf("1..%d\n", numtests); 40 41 /* probably not necessary, but tear down the screen */42 endwin();43 fclose(rnull);44 fclose(wnull);45 46 39 return(numfailures); 47 40 } … … 300 293 } 301 294 295 296 int owl_obarray_regtest(void) { 297 int numfailed = 0; 298 const char *p,*p2; 299 300 owl_obarray oa; 301 owl_obarray_init(&oa); 302 303 printf("# BEGIN testing owl_obarray\n"); 304 305 p = owl_obarray_insert(&oa, "test"); 306 FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test")); 307 p2 = owl_obarray_insert(&oa, "test"); 308 FAIL_UNLESS("returned string is equal", p2 && !strcmp(p2, "test")); 309 FAIL_UNLESS("returned the same string", p2 && p == p2); 310 311 p = owl_obarray_insert(&oa, "test2"); 312 FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test2")); 313 p2 = owl_obarray_find(&oa, "test2"); 314 FAIL_UNLESS("returned the same string", p2 && !strcmp(p2, "test2")); 315 316 p = owl_obarray_find(&oa, "nothere"); 317 FAIL_UNLESS("Didn't find a string that isn't there", p == NULL); 318 319 printf("# END testing owl_obarray (%d failures)\n", numfailed); 320 321 return numfailed; 322 } 323 302 324 int owl_editwin_regtest(void) { 303 325 int numfailed = 0;
Note: See TracChangeset
for help on using the changeset viewer.