resonance 1.0.1
Loading...
Searching...
No Matches
TestRegistry Class Reference

Table of named self-tests that the hx.test script command runs. More...

#include <testregistry.h>

Collaboration diagram for TestRegistry:

Classes

struct  Entry
 One registered test. More...

Public Types

typedef int(* TestFunc) ()
 A self-test.

Static Public Member Functions

static void Register (const char *pszName, TestFunc pfnTest)
 Append a test to the table.
static TestFunc Find (const char *pszName)
 Look a test up by name.

Static Public Attributes

static constexpr int kMaxTests = 64
 Slots of the table, bounded by the next object at 0x008efb50 rather than measured.
static Entry sTests [kMaxTests]
 The registered tests, in registration order.
static int sTestCount
 The number of registered tests.

Detailed Description

Table of named self-tests that the hx.test script command runs.

The class has no instance and no RTTI, so the title is inferred from the command's messages, requires 1 arg (name of test) and valid tests are:. A unit that carries a self-test registers it from its static initialiser, as the PlayMapLinear and TrackSelector units do. The command expands Find() inline rather than calling it.

Member Typedef Documentation

◆ TestFunc

typedef int(* TestRegistry::TestFunc) ()

A self-test.

It takes no arguments, reports through the log, and reports pass or fail.

Member Function Documentation

◆ Register()

void TestRegistry::Register ( const char * pszName,
TestFunc pfnTest )
static

Append a test to the table.

The count is not checked against the table's size.

Parameters
pszNameThe name the command matches.
pfnTestThe test.
Ghidra address:
NTSC-U/C: 0x0015fda8
Ghidra address:
PAL: 0x00161cc8

◆ Find()

TestFunc TestRegistry::Find ( const char * pszName)
static

Look a test up by name.

Parameters
pszNameThe name.
Returns
The first test registered under the name, or null.
Ghidra address:
NTSC-U/C: 0x0015fdd8
Ghidra address:
PAL: 0x00161cf8

Member Data Documentation

◆ kMaxTests

int TestRegistry::kMaxTests = 64
staticconstexpr

Slots of the table, bounded by the next object at 0x008efb50 rather than measured.

◆ sTests

Entry TestRegistry::sTests[kMaxTests]
static

The registered tests, in registration order.

Public because the command walks the table itself to list the valid tests.

Ghidra address:
NTSC-U/C: 0x008ef950
Ghidra address:
PAL: 0x00934950

◆ sTestCount

int TestRegistry::sTestCount
static

The number of registered tests.

Ghidra address:
NTSC-U/C: 0x0086f790
Ghidra address:
PAL: 0x008b3e70

The documentation for this class was generated from the following file: