Clone wiki

testing / Home

Using testrun

The testrun module implements Itestset as a command frontend. There are two commands: ?lt (list tests) and ?rt (run test). Load testrun and then when a module calls AddTest you will be able to access it with those commands.

Using Itestset

Here's a snippet of a way to use the Itestset interface from a module:

#include "testset.h"

local Itestset *tests;

local TestItem test_items[NUMBER_OF_TESTS];

/* Test function prototypes */
local int TDoSomething1();
local int TDoSomething2();
local int TDoSomething3();

local void RegisterTests()
    int i = 0;
    test_items[i++] = tests->AddTest("Do Something", TDoSomething1);
    test_items[i++] = tests->AddTest("Do Another Thing", TDoSomething2);
    test_items[i++] = tests->AddTest("Do Yet Another Thing", TDoSomething3);

local void UnregisterTests()
    for(int i = 0; i < NUMBER_OF_TESTS; i++)

Then in your module entry point you can put RegisterTests in MM_LOAD and UnregisterTests in MM_UNLOAD if you want them to automatically be available when you load the module.