Changeset 8bce750 for util.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
  • util.c

    r9e5c9f3 r8bce750  
    758758  return 0;
    759759}
    760 
    761 /**************************************************************************/
    762 /************************* REGRESSION TESTS *******************************/
    763 /**************************************************************************/
    764 
    765 #ifdef OWL_INCLUDE_REG_TESTS
    766 
    767 #include "test.h"
    768 
    769 int owl_util_regtest(void)
    770 {
    771   int numfailed=0;
    772 
    773   printf("# BEGIN testing owl_util\n");
    774 
    775   FAIL_UNLESS("owl_util_substitute 1",
    776               !strcmp("foo", owl_text_substitute("foo", "", "Y")));
    777   FAIL_UNLESS("owl_text_substitute 2",
    778               !strcmp("fYZYZ", owl_text_substitute("foo", "o", "YZ")));
    779   FAIL_UNLESS("owl_text_substitute 3",
    780               !strcmp("foo", owl_text_substitute("fYZYZ", "YZ", "o")));
    781   FAIL_UNLESS("owl_text_substitute 4",
    782               !strcmp("/u/foo/meep", owl_text_substitute("~/meep", "~", "/u/foo")));
    783 
    784   FAIL_UNLESS("skiptokens 1",
    785               !strcmp("bar quux", skiptokens("foo bar quux", 1)));
    786   FAIL_UNLESS("skiptokens 2",
    787               !strcmp("meep", skiptokens("foo 'bar quux' meep", 2)));
    788 
    789   FAIL_UNLESS("expand_tabs 1",
    790               !strcmp("        hi", owl_text_expand_tabs("\thi")));
    791 
    792   FAIL_UNLESS("expand_tabs 2",
    793               !strcmp("        hi\nword    tab", owl_text_expand_tabs("\thi\nword\ttab")));
    794 
    795   FAIL_UNLESS("expand_tabs 3",
    796               !strcmp("                2 tabs", owl_text_expand_tabs("\t\t2 tabs")));
    797 
    798   /* if (numfailed) printf("*** WARNING: failures encountered with owl_util\n"); */
    799   printf("# END testing owl_util (%d failures)\n", numfailed);
    800   return(numfailed);
    801 }
    802 
    803 #endif /* OWL_INCLUDE_REG_TESTS */
Note: See TracChangeset for help on using the changeset viewer.