Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::UnitTest Struct Reference

Simple unit test class. More...

#include <test.hh>

Collaboration diagram for ghidra::UnitTest:
[legend]

Public Member Functions

 UnitTest (const string &name, testfunc_t func)
 Constructor.
 

Static Public Member Functions

static vector< UnitTest * > & tests ()
 The collection of test objects.
 
static int run (set< string > &testNames)
 Run all the instantiated tests.
 

Public Attributes

string name
 Name of the test.
 
testfunc_t func
 Call-back function executing the test.
 

Detailed Description

Simple unit test class.

The macro TEST instantiates this object with a name and function pointer. The static run() method calls all the function pointers of all instantiated objects.

Constructor & Destructor Documentation

◆ UnitTest()

ghidra::UnitTest::UnitTest ( const string &  name,
testfunc_t  func 
)
inline

Constructor.

Parameters
nameis the identifier for the test
funcis a call-back function that executes the test

References tests().

Member Function Documentation

◆ run()

int ghidra::UnitTest::run ( set< string > &  testNames)
static

Run all the instantiated tests.

Run all the tests unless a non-empty set of names is passed in. In which case, only the named tests in the set are run.

Parameters
testNamesis the set of names
Returns
number of failed tests

References ghidra::LowlevelError::explain, and tests().


The documentation for this struct was generated from the following files: