Changeset 8bce750 for obarray.c


Ignore:
Timestamp:
Aug 17, 2009, 9:52:16 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
e30ed92
Parents:
a2b3289
git-author:
Nelson Elhage <nelhage@mit.edu> (08/17/09 21:51:29)
git-committer:
Nelson Elhage <nelhage@mit.edu> (08/17/09 21:52:16)
Message:
Move all regression tests into tester.c.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • obarray.c

    rb1d5517 r8bce750  
    6666  owl_list_create(&(oa->strings));
    6767}
    68 
    69 /**************************************************************************/
    70 /************************* REGRESSION TESTS *******************************/
    71 /**************************************************************************/
    72 
    73 #ifdef OWL_INCLUDE_REG_TESTS
    74 
    75 #include "test.h"
    76 
    77 int owl_obarray_regtest(void) {
    78   int numfailed = 0;
    79   const char *p,*p2;
    80 
    81   owl_obarray oa;
    82   owl_obarray_init(&oa);
    83 
    84   printf("# BEGIN testing owl_obarray\n");
    85 
    86   p = owl_obarray_insert(&oa, "test");
    87   FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test"));
    88   p2 = owl_obarray_insert(&oa, "test");
    89   FAIL_UNLESS("returned string is equal", p2 && !strcmp(p2, "test"));
    90   FAIL_UNLESS("returned the same string", p2 && p == p2);
    91 
    92   p = owl_obarray_insert(&oa, "test2");
    93   FAIL_UNLESS("returned string is equal", p && !strcmp(p, "test2"));
    94   p2 = owl_obarray_find(&oa, "test2");
    95   FAIL_UNLESS("returned the same string", p2 && !strcmp(p2, "test2"));
    96 
    97   p = owl_obarray_find(&oa, "nothere");
    98   FAIL_UNLESS("Didn't find a string that isn't there", p == NULL);
    99 
    100   printf("# END testing owl_obarray (%d failures)\n", numfailed);
    101 
    102   return numfailed;
    103 }
    104 
    105 #endif /* OWL_INCLUDE_REG_TESTS */
Note: See TracChangeset for help on using the changeset viewer.