Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
TestBase Class Referenceabstract

#include <test.h>

+ Inheritance diagram for TestBase:
+ Collaboration diagram for TestBase:

Public Member Functions

bool testModule (IGameDef *gamedef)
 
std::string getTestTempDirectory ()
 
std::string getTestTempFile ()
 
virtual void runTests (IGameDef *gamedef)=0
 
virtual const char * getName ()=0
 
void runTest (const char *name, std::function< void()> &&test)
 

Public Attributes

u32 num_tests_failed
 
u32 num_tests_run
 

Private Attributes

std::string m_test_dir
 

Member Function Documentation

◆ getName()

◆ getTestTempDirectory()

std::string TestBase::getTestTempDirectory ( )

References fs::CreateTempDir(), m_test_dir, and UASSERT.

Referenced by getTestTempFile(), TestBan::reinitTestEnv(), TestAuthDatabase::runTests(), TestModStorageDatabase::runTests(), TestMoveAction::runTests(), TestSAO::runTests(), TestServerModManager::runTests(), TestFileSys::testCopyFileContents(), TestMapSettingsManager::testMapMetaSaveLoad(), and TestFileSys::testRecursiveDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTestTempFile()

std::string TestBase::getTestTempFile ( )

References DIR_DELIM, getTestTempDirectory(), porting::mt_snprintf(), and myrand().

Referenced by TestMapSettingsManager::makeMetaFile(), TestSAO::runTests(), TestSchematic::testFileSerializeDeserialize(), TestFileSys::testNonExist(), and TestFileSys::testSafeWriteToFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ runTest()

void TestBase::runTest ( const char * name,
std::function< void()> && test )

References TestFailedException::file, porting::getTimeMs(), TestFailedException::line, TestFailedException::message, num_tests_failed, num_tests_run, and rawstream.

+ Here is the call graph for this function:

◆ runTests()

◆ testModule()

bool TestBase::testModule ( IGameDef * gamedef)

References getName(), porting::getTimeMs(), m_test_dir, num_tests_failed, num_tests_run, rawstream, fs::RecursiveDelete(), and runTests().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_test_dir

std::string TestBase::m_test_dir
private

Referenced by getTestTempDirectory(), and testModule().

◆ num_tests_failed

u32 TestBase::num_tests_failed

◆ num_tests_run

u32 TestBase::num_tests_run

Referenced by runTest(), and testModule().


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