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.18 1999/02/20 21:28:09 grubba Exp $ */ + /* $Id: test_pike.pike,v 1.19 1999/03/01 05:32:08 hubbe Exp $ */      #include <simulate.h>      #if !efun(_verify_internals)   #define _verify_internals()   #endif    - #define SHIFT_MAX 0 /* 2 */ -  +    int foo(string opt)   {    if(opt=="" || !opt) return 1;    return (int)opt;   }      mapping(string:int) cond_cache=([]);      #if constant(thread_create)   #define HAVE_DEBUG
pike.git/bin/test_pike.pike:24:      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;    string extra_info=""; +  int shift;    -  +    #if constant(signal) && constant(signum)    if(signum("SIGQUIT")>=0)    {    signal(signum("SIGQUIT"),lambda()    {    master()->handle_error( ({"\nSIGQUIT recived, printing backtrace and continuing.\n",backtrace() }) );    });    }   #endif   
pike.git/bin/test_pike.pike:123:    werror("Failed to read test file, errno="+errno()+".\n");    exit(1);    }       tests=tmp/"\n....\n";    tmp=0;    tests=tests[0..sizeof(tests)-2];       werror("Doing tests in %s (%d tests)\n",argv[f],sizeof(tests));    -  +     for(e=start;e<sizeof(tests);e++)    {    string test,condition;    int type;    object o;    mixed a,b;       if(check) _verify_internals();       test=tests[e];
pike.git/bin/test_pike.pike:163:    sscanf(test,"%s\n%s",type,test);    sscanf(type,"%*s expected result: %s",type);       if(verbose)    {    werror("Doing test %d (%d total)%s\n",e+1,successes+errors+1,extra_info);    if(verbose>1)    werror(test+"\n");    }    -  for(int shift=0;shift <= SHIFT_MAX;shift++) { -  +     if(check > 1) _verify_internals();    -  +  shift++;    string fname = argv[f] + ": Test " + (e + 1) +    " (shift " + shift + ")";       string widener = ([ 0:"",    1:"\nint \x30c6\x30b9\x30c8=0;\n", -  2:"\nint \x10001=0;\n" ])[shift]; +  2:"\nint \x10001=0;\n" ])[shift%3];       switch(type)    {    case "COMPILE":    if(catch(compile_string(test + widener, fname)))    {    werror(fname + " failed.\n");    werror(test+"\n");    errors++;    }else{
pike.git/bin/test_pike.pike:293:    werror(sprintf("%s: Unknown test type (%O).\n", fname, 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();    write(sprintf("%-10s: %6s %10s\n","Category","num","bytes"));    foreach(sort(indices(tmp)),string foo)    {