Branch: Tag:

2001-01-31

2001-01-31 00:56:04 by Per Hedbor <ph@opera.com>

More tests

Rev: server/etc/test/tests/db/RoxenTest_dbmanager.pike:1.1
Rev: server/etc/test/tests/pike_test_common.pike:1.3
Rev: server/etc/test/tests/userdbmodules/RoxenTest_userdbs.pike:1.4

11:    if( arg->is_module )    res += ({ sprintf("%s",arg->my_configuration()->otomod[arg])});    else if( arg->is_configuration ) -  res += ({ "Config" }); +  res += ({ sprintf("%s", arg->name ) });    else    res += ({ sprintf("%O", arg ) });    else
19:    return res * ", ";   }    - void report_1st(function cb, array args ) + void report_1st(function cb, array args, function check )   { -  report_error(" Test %3d %-40s ", current_test, -  sprintf("%O("+describe_arglist( args )+")",cb)[..39]); +  int checkid = ' '; +  if( check == check_error ) +  checkid = '#'; +  else if( check == check_false ) +  checkid = '!'; +  else if( check != check_is_configuration && +  check == check_is_module ) +  checkid = '~'; +  +  report_error(" Test %3d %c%-40s ", current_test, +  checkid,sprintf("%O("+describe_arglist( args )+")",cb)[..39] +  );   }      string do_describe_error( mixed err )
45:   void report_test_ok( mixed err, function cb, array args, int st )   {    report_error("OK [%dms]\n", (gethrtime()-st)/1000); -  if( err ) report_error( do_describe_error( err ) ); + // if( err ) report_error( do_describe_error( err ) );   }      
53:   {    current_test++;    mixed result; -  report_1st( cb, args ); +  report_1st( cb, args, check_return );    int st = gethrtime();    mixed err = catch {    result = cb( @args );
101:   }       - void check_is_not_zero( mixed res, mixed err, function cb, array args, int st ) + void check_true( mixed res, mixed err, function cb, array args, int st )   {    if( err )    report_test_failure( err, cb, args, st );
112:    report_test_ok( err, cb, args, st );   }    + void check_false( mixed res, mixed err, function cb, array args, int st ) + { +  if( err ) +  report_test_failure( err, cb, args, st ); +  else +  if( res ) +  report_test_failure( sprintf("expected zero, got %O",res), cb, args, st); +  else +  report_test_ok( err, cb, args, st ); + }    -  +    function check_is( mixed m )   {    return
129:    };   }    + mixed pass( mixed arg ) + { +  return arg; + } +    function check_equal( mixed m )   {    return