ldmud-3.3.719/
ldmud-3.3.719/doc/
ldmud-3.3.719/doc/efun.de/
ldmud-3.3.719/doc/efun/
ldmud-3.3.719/doc/man/
ldmud-3.3.719/doc/other/
ldmud-3.3.719/mud/
ldmud-3.3.719/mud/heaven7/
ldmud-3.3.719/mud/lp-245/
ldmud-3.3.719/mud/lp-245/banish/
ldmud-3.3.719/mud/lp-245/doc/
ldmud-3.3.719/mud/lp-245/doc/examples/
ldmud-3.3.719/mud/lp-245/doc/sefun/
ldmud-3.3.719/mud/lp-245/log/
ldmud-3.3.719/mud/lp-245/obj/Go/
ldmud-3.3.719/mud/lp-245/players/lars/
ldmud-3.3.719/mud/lp-245/room/death/
ldmud-3.3.719/mud/lp-245/room/maze1/
ldmud-3.3.719/mud/lp-245/room/sub/
ldmud-3.3.719/mud/lp-245/secure/
ldmud-3.3.719/mud/sticklib/
ldmud-3.3.719/mud/sticklib/src/
ldmud-3.3.719/mudlib/deprecated/
ldmud-3.3.719/mudlib/uni-crasher/
ldmud-3.3.719/pkg/
ldmud-3.3.719/pkg/debugger/
ldmud-3.3.719/pkg/diff/
ldmud-3.3.719/pkg/misc/
ldmud-3.3.719/src/
ldmud-3.3.719/src/autoconf/
ldmud-3.3.719/src/ptmalloc/
ldmud-3.3.719/src/util/
ldmud-3.3.719/src/util/erq/
ldmud-3.3.719/src/util/indent/hosts/next/
ldmud-3.3.719/src/util/xerq/
ldmud-3.3.719/src/util/xerq/lpc/
ldmud-3.3.719/src/util/xerq/lpc/www/
ldmud-3.3.719/test/generic/
ldmud-3.3.719/test/inc/
ldmud-3.3.719/test/t-0000398/
ldmud-3.3.719/test/t-0000548/
ldmud-3.3.719/test/t-030925/
ldmud-3.3.719/test/t-040413/
ldmud-3.3.719/test/t-041124/
ldmud-3.3.719/test/t-language/
// Indices into the array of a test.
#define TI_NAME          0       // The name of the test
#define TI_FLAGS         1       // Some Flags
#define TI_CLOSURE       2       // The function to be evaluated

// Flags
#define TF_ERROR          1       // The function should generate an error.
#define TF_DONTCHECKERROR 2       // Doesn't matter if error or not, as long as it does not crash.

void run_array(mixed* testarray, closure callback)
{
    int errors;
    
    // If there's an error:
    call_out(callback, 0, 1);
    
    foreach(mixed test: testarray)
    {
        msg("Running Test %s...", test[TI_NAME]);

        if(test[TI_FLAGS]&TF_ERROR)
        {
            if(!catch(funcall(test[TI_CLOSURE]);nolog))
            {
                errors++;
                msg(" FAILURE! (There was no error.)\n");
            }
            else
                msg(" Success.\n");
        }
        else if (test[TI_FLAGS]&TF_DONTCHECKERROR)
        {
            catch(funcall(test[TI_CLOSURE]);nolog);
            // if we surived the test: great
            msg(" Success.\n");
        }
        else
        {
            if(funcall(test[TI_CLOSURE]))
                msg(" Success.\n");
            else
            {
                errors++;
                msg(" FAILURE! (Wrong result.)\n");
            }
        }
    }
    
    remove_call_out(callback);

    funcall(callback, errors && 1);
}