pike.git / bin / test_pike.pike

version» Context lines:

pike.git/bin/test_pike.pike:1:   #!/usr/local/bin/pike    - /* $Id: test_pike.pike,v 1.7 1998/03/20 22:29:39 hubbe Exp $ */ + /* $Id: test_pike.pike,v 1.8 1998/04/06 03:19:37 hubbe Exp $ */      #include <simulate.h>      #if !efun(_verify_internals)   #define _verify_internals()   #endif      int foo(string opt)   {    if(opt=="" || !opt) return 1;    return (int)opt;   }   int main(int argc, string *argv)   {    int e, verbose, successes, errors, t, check;    string *tests,tmp;    program testprogram;    int start, fail, mem;    int loop=1; -  +  int end=0x7fffffff;       foreach(Getopt.find_all_options(argv,aggregate(    ({"help",Getopt.NO_ARG,({"-h","--help"})}),    ({"verbose",Getopt.NO_ARG,({"-v","--verbose"})}),    ({"start",Getopt.HAS_ARG,({"-s","--start-test"})}), -  +  ({"end",Getopt.HAS_ARG,({"--end-after"})}),    ({"fail",Getopt.MAY_HAVE_ARG,({"-f","--fail"})}),    ({"loop",Getopt.MAY_HAVE_ARG,({"-l","--loop"})}),    ({"trace",Getopt.MAY_HAVE_ARG,({"-t","--trace"})}),    ({"check",Getopt.MAY_HAVE_ARG,({"-c","--check"})}),    ({"mem",Getopt.MAY_HAVE_ARG,({"-m","--mem","--memory"})}),    )),array opt)    {    switch(opt[0])    {    case "help":    werror("Usage: "+argv[e]+" [-v | --verbose] [-h | --help] [-t <testno>] <testfile>\n");    return 0;       case "verbose": verbose+=foo(opt[1]); break;    case "start": start=foo(opt[1]); start--; break; -  +  case "end": end=foo(opt[1]); break;    case "fail": fail+=foo(opt[1]); break;    case "loop": loop+=foo(opt[1]); break;    case "trace": t+=foo(opt[1]); break;    case "check": check+=foo(opt[1]); break;    case "mem": mem+=foo(opt[1]); break;    }    }       argv=Getopt.get_args(argv,1);    if(sizeof(argv)<1)
pike.git/bin/test_pike.pike:201:    werror(sprintf("Unknown test type (%O).\n",type));    errors++;    }    }       if(check > 2) _verify_internals();       if(fail && errors)    exit(1);    +  if(!--end) exit(0); +     a=b=0;    }       }    if(mem)    {    int total;    tests=0;    gc();    mapping tmp=_memory_usage();
pike.git/bin/test_pike.pike:234:    "Total",    "",    total));    }    }    if(errors || verbose)    {    werror("Failed tests: "+errors+".\n");    }    -  if(verbose) -  { +     werror("Total tests: %d\n",successes+errors); -  } +        return errors;   }