Ghidra Decompiler Analysis Engine
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
UnitTest Struct Reference

Simple unit test class. More...

#include <test.hh>

Public Member Functions

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

Static Public Member Functions

static void run (std::set< std::string > &testNames)
 Run all the instantiated tests. More...
 

Public Attributes

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

Static Public Attributes

static std::vector< UnitTest * > tests
 The collection of test objects.
 

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()

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

Constructor.

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

Member Function Documentation

◆ run()

void UnitTest::run ( std::set< std::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

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