Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
TestSchematic Class Reference
+ Inheritance diagram for TestSchematic:
+ Collaboration diagram for TestSchematic:

Public Member Functions

 TestSchematic ()
 
const char * getName ()
 
void runTests (IGameDef *gamedef)
 
void testMtsSerializeDeserialize (const NodeDefManager *ndef)
 
void testLuaTableSerialize (const NodeDefManager *ndef)
 
void testFileSerializeDeserialize (const NodeDefManager *ndef)
 
- Public Member Functions inherited from TestBase
bool testModule (IGameDef *gamedef)
 
std::string getTestTempDirectory ()
 
std::string getTestTempFile ()
 
void runTest (const char *name, std::function< void()> &&test)
 

Static Public Attributes

static const content_t test_schem1_data [7 *6 *4]
 
static const content_t test_schem2_data [3 *3 *3]
 
static const u8 test_schem2_prob [3 *3 *3]
 
static const char * expected_lua_output
 

Additional Inherited Members

- Public Attributes inherited from TestBase
u32 num_tests_failed
 
u32 num_tests_run
 

Constructor & Destructor Documentation

◆ TestSchematic()

TestSchematic::TestSchematic ( )
inline

References TestManager::registerTestModule().

+ Here is the call graph for this function:

Member Function Documentation

◆ getName()

const char * TestSchematic::getName ( )
inlinevirtual

Implements TestBase.

◆ runTests()

void TestSchematic::runTests ( IGameDef * gamedef)
virtual

Implements TestBase.

References IGameDef::getNodeDefManager(), NodeDefManager::resetNodeResolveState(), NodeDefManager::setNodeRegistrationStatus(), TEST, testFileSerializeDeserialize(), testLuaTableSerialize(), and testMtsSerializeDeserialize().

+ Here is the call graph for this function:

◆ testFileSerializeDeserialize()

void TestSchematic::testFileSerializeDeserialize ( const NodeDefManager * ndef)

References CONTENT_AIR, Schematic::flags, TestBase::getTestTempFile(), Schematic::loadSchematicFromFile(), NodeResolver::m_resolve_done, Schematic::saveSchematicToFile(), Schematic::schemdata, Schematic::size, Schematic::slice_probs, t_CONTENT_LAVA, t_CONTENT_STONE, t_CONTENT_WATER, test_schem2_data, test_schem2_prob, and UASSERT.

Referenced by runTests().

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

◆ testLuaTableSerialize()

void TestSchematic::testLuaTableSerialize ( const NodeDefManager * ndef)

References expected_lua_output, Schematic::flags, NodeResolver::m_nodenames, MTSCHEM_PROB_ALWAYS, Schematic::schemdata, Schematic::serializeToLua(), Schematic::size, Schematic::slice_probs, test_schem2_data, test_schem2_prob, UASSERT, and UASSERTEQ.

Referenced by runTests().

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

◆ testMtsSerializeDeserialize()

void TestSchematic::testMtsSerializeDeserialize ( const NodeDefManager * ndef)

References Schematic::deserializeFromMts(), Schematic::flags, NodeResolver::m_nodenames, MTSCHEM_PROB_ALWAYS, Schematic::schemdata, Schematic::serializeToMts(), Schematic::size, Schematic::slice_probs, test_schem1_data, UASSERT, and UASSERTEQ.

Referenced by runTests().

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

Member Data Documentation

◆ expected_lua_output

const char * TestSchematic::expected_lua_output
static

Referenced by testLuaTableSerialize().

◆ test_schem1_data

const content_t TestSchematic::test_schem1_data
static
Initial value:
= {
3, 3, 1, 1, 1, 3, 3,
3, 0, 1, 2, 1, 0, 3,
3, 0, 1, 2, 1, 0, 3,
3, 1, 1, 2, 1, 1, 3,
3, 2, 2, 2, 2, 2, 3,
3, 1, 1, 2, 1, 1, 3,
0, 0, 1, 1, 1, 0, 0,
0, 0, 1, 2, 1, 0, 0,
0, 0, 1, 2, 1, 0, 0,
1, 1, 1, 2, 1, 1, 1,
1, 2, 2, 2, 2, 2, 1,
1, 1, 1, 2, 1, 1, 1,
0, 0, 1, 1, 1, 0, 0,
0, 0, 1, 2, 1, 0, 0,
0, 0, 1, 2, 1, 0, 0,
1, 1, 1, 2, 1, 1, 1,
1, 2, 2, 2, 2, 2, 1,
1, 1, 1, 2, 1, 1, 1,
3, 3, 1, 1, 1, 3, 3,
3, 0, 1, 2, 1, 0, 3,
3, 0, 1, 2, 1, 0, 3,
3, 1, 1, 2, 1, 1, 3,
3, 2, 2, 2, 2, 2, 3,
3, 1, 1, 2, 1, 1, 3,
}

Referenced by testMtsSerializeDeserialize().

◆ test_schem2_data

const content_t TestSchematic::test_schem2_data
static
Initial value:
= {
0, 0, 0,
0, 2, 0,
0, 0, 0,
0, 2, 0,
2, 1, 2,
0, 2, 0,
0, 0, 0,
0, 2, 0,
0, 0, 0,
}

Referenced by testFileSerializeDeserialize(), and testLuaTableSerialize().

◆ test_schem2_prob

const u8 TestSchematic::test_schem2_prob
static
Initial value:
= {
0x00, 0x00, 0x00,
0x00, 0xFF, 0x00,
0x00, 0x00, 0x00,
0x00, 0xFF, 0x00,
0xFF, 0xFF, 0xFF,
0x00, 0xFF, 0x00,
0x00, 0x00, 0x00,
0x00, 0xFF, 0x00,
0x00, 0x00, 0x00,
}

Referenced by testFileSerializeDeserialize(), and testLuaTableSerialize().


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