Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
TestRandom Class Reference
+ Inheritance diagram for TestRandom:
+ Collaboration diagram for TestRandom:

Public Member Functions

 TestRandom ()
 
const char * getName ()
 
void runTests (IGameDef *gamedef)
 
void testPseudoRandom ()
 
void testPseudoRandomRange ()
 
void testPcgRandom ()
 
void testPcgRandomRange ()
 
void testPcgRandomBytes ()
 
void testPcgRandomNormalDist ()
 
- Public Member Functions inherited from TestBase
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)
 

Static Public Attributes

static const s32 expected_pseudorandom_results [256]
 
static const u32 expected_pcgrandom_results [256]
 
static const u8 expected_pcgrandom_bytes_result [24]
 
static const u8 expected_pcgrandom_bytes_result2 [24]
 

Additional Inherited Members

- Public Attributes inherited from TestBase
u32 num_tests_failed
 
u32 num_tests_run
 

Constructor & Destructor Documentation

◆ TestRandom()

TestRandom::TestRandom ( )
inline

References TestManager::registerTestModule().

+ Here is the call graph for this function:

Member Function Documentation

◆ getName()

const char * TestRandom::getName ( )
inlinevirtual

Implements TestBase.

◆ runTests()

void TestRandom::runTests ( IGameDef gamedef)
virtual

Implements TestBase.

References TEST, testPcgRandom(), testPcgRandomBytes(), testPcgRandomNormalDist(), testPcgRandomRange(), testPseudoRandom(), and testPseudoRandomRange().

+ Here is the call graph for this function:

◆ testPcgRandom()

void TestRandom::testPcgRandom ( )

References expected_pcgrandom_results, PcgRandom::getState(), PcgRandom::next(), PcgRandom::setState(), and UASSERTEQ.

Referenced by runTests().

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

◆ testPcgRandomBytes()

void TestRandom::testPcgRandomBytes ( )

References PcgRandom::bytes(), expected_pcgrandom_bytes_result, expected_pcgrandom_bytes_result2, and UASSERT.

Referenced by runTests().

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

◆ testPcgRandomNormalDist()

void TestRandom::testPcgRandomNormalDist ( )

References ARRLEN, myround(), PcgRandom::randNormalDist(), and UASSERT.

Referenced by runTests().

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

◆ testPcgRandomRange()

void TestRandom::testPcgRandomRange ( )

References EXCEPTION_CHECK, PcgRandom::next(), PcgRandom::RANDOM_MAX, PcgRandom::RANDOM_MIN, PcgRandom::range(), SWAP, and UASSERT.

Referenced by runTests().

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

◆ testPseudoRandom()

void TestRandom::testPseudoRandom ( )

References expected_pseudorandom_results, PseudoRandom::getState(), PseudoRandom::next(), and UASSERTEQ.

Referenced by runTests().

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

◆ testPseudoRandomRange()

void TestRandom::testPseudoRandomRange ( )

References EXCEPTION_CHECK, PseudoRandom::next(), PseudoRandom::range(), SWAP, and UASSERT.

Referenced by runTests().

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

Member Data Documentation

◆ expected_pcgrandom_bytes_result

const u8 TestRandom::expected_pcgrandom_bytes_result
static
Initial value:
= {
0xf3, 0x79, 0x8f, 0x31, 0xac, 0xd9, 0x34, 0xf8, 0x3c, 0x6e, 0x82, 0x37,
0x6b, 0x4b, 0x77, 0xe3, 0xbd, 0x0a, 0xee, 0x22, 0x79, 0x6e, 0x40, 0x00,
}

Referenced by testPcgRandomBytes().

◆ expected_pcgrandom_bytes_result2

const u8 TestRandom::expected_pcgrandom_bytes_result2
static
Initial value:
= {
0x47, 0x9e, 0x08, 0x3e, 0xd4, 0x21, 0x2d, 0xf6, 0xb4, 0xb1, 0x9d, 0x7a,
0x60, 0x02, 0x5a, 0xb2, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}

Referenced by testPcgRandomBytes().

◆ expected_pcgrandom_results

const u32 TestRandom::expected_pcgrandom_results
static

Referenced by testPcgRandom().

◆ expected_pseudorandom_results

const s32 TestRandom::expected_pseudorandom_results
static

Referenced by testPseudoRandom().


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