Changeset 1cf3f8d3


Ignore:
Timestamp:
Jul 7, 2007, 5:42:45 PM (17 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
535d68b
Parents:
9a6cc40
Message:
Make the built-in regression tests output TAP and add a perl wrapper
to call it.
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    r702aee7 r1cf3f8d3  
    4545#AUTOGEN=$(GEN_C)
    4646
    47 HEADERS=$(GEN_H) owl.h config.h
     47HEADERS=$(GEN_H) owl.h config.h test.h
    4848
    4949%.o: %.c $(HEADERS)
  • dict.c

    r0138478 r1cf3f8d3  
    152152  char *av="aval", *bv="bval", *cv="cval", *dv="dval";
    153153
    154   printf("BEGIN testing owl_dict\n");
     154  printf("# BEGIN testing owl_dict\n");
    155155  FAIL_UNLESS("create", 0==owl_dict_create(&d));
    156156  FAIL_UNLESS("insert b", 0==owl_dict_insert_element(&d, "b", (void*)bv, owl_dict_noop_free));
     
    179179  owl_dict_free_all(&d, NULL);
    180180
    181   if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
    182   printf("END testing owl_dict (%d failures)\n", numfailed);
     181  //  if (numfailed) printf("*** WARNING: failures encountered with owl_dict\n");
     182  printf("# END testing owl_dict (%d failures)\n", numfailed);
    183183  return(numfailed);
    184184}
  • test.h

    r0138478 r1cf3f8d3  
    33
    44#define FAIL_UNLESS(desc,pred) do { int __pred = (pred);                \
    5     printf("\t%-4s: %s", (__pred)?"ok":(numfailed++,"FAIL"), desc);     \
     5    printf("%s %s", (__pred)?"ok":(numfailed++,"not ok"), desc);     \
    66    if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0)
    77
  • tester.c

    re7dc035 r1cf3f8d3  
    143143
    144144
     145#define OWL_DICT_NTESTS  20
     146#define OWL_UTIL_NTESTS  9
     147#define OWL_OBARRAY_NTESTS  5
     148#define OWL_VARIABLE_NTESTS  52
     149#define OWL_FILTER_NTESTS  23
     150
    145151int main(int argc, char **argv, char **env)
    146152{
     
    149155
    150156  int numfailures=0;
    151   if (argc==2 && 0==strcmp(argv[1],"reg")) {
     157  if (argc==1 || (argc==2 && 0==strcmp(argv[1],"reg"))) {
     158    printf("1..%d\n", OWL_UTIL_NTESTS+OWL_DICT_NTESTS+OWL_VARIABLE_NTESTS
     159           +OWL_FILTER_NTESTS+OWL_OBARRAY_NTESTS);
    152160    numfailures += owl_util_regtest();
    153161    numfailures += owl_dict_regtest();
     
    156164    numfailures += owl_obarray_regtest();
    157165    if (numfailures) {
    158       fprintf(stderr, "*** WARNING: %d failures total\n", numfailures);
     166      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
    159167    }
    160168    return(numfailures);
  • util.c

    rc2c5c77 r1cf3f8d3  
    789789  int numfailed=0;
    790790
    791   printf("BEGIN testing owl_util\n");
     791  printf("# BEGIN testing owl_util\n");
    792792
    793793  FAIL_UNLESS("owl_util_substitute 1",
     
    812812              !strcmp("meep foo bar", owl_util_uniq("meep foo", "bar foo meep", "-")));
    813813
    814   if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
    815   printf("END testing owl_util (%d failures)\n", numfailed);
     814  // if (numfailed) printf("*** WARNING: failures encountered with owl_util\n");
     815  printf("# END testing owl_util (%d failures)\n", numfailed);
    816816  return(numfailed);
    817817}
  • variable.c

    ra695a68 r1cf3f8d3  
    977977  in_regtest = 1;
    978978
    979   printf("BEGIN testing owl_variable\n");
     979  printf("# BEGIN testing owl_variable\n");
    980980  FAIL_UNLESS("setup", 0==owl_variable_dict_setup(&vd));
    981981
     
    10491049  owl_variable_dict_free(&vd);
    10501050
    1051   if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
    1052   printf("END testing owl_variable (%d failures)\n", numfailed);
     1051  // if (numfailed) printf("*** WARNING: failures encountered with owl_variable\n");
     1052  printf("# END testing owl_variable (%d failures)\n", numfailed);
    10531053  return(numfailed);
    10541054}
Note: See TracChangeset for help on using the changeset viewer.