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

Public Member Functions

 TestInventory ()
 
const char * getName ()
 
void runTests (IGameDef *gamedef)
 
void testSerializeDeserialize (IItemDefManager *idef)
 
- 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 char * serialized_inventory_in
 
static const char * serialized_inventory_out
 
static const char * serialized_inventory_inc
 

Additional Inherited Members

- Public Attributes inherited from TestBase
u32 num_tests_failed
 
u32 num_tests_run
 

Constructor & Destructor Documentation

◆ TestInventory()

TestInventory::TestInventory ( )
inline

References TestManager::registerTestModule().

+ Here is the call graph for this function:

Member Function Documentation

◆ getName()

const char * TestInventory::getName ( )
inlinevirtual

Implements TestBase.

◆ runTests()

void TestInventory::runTests ( IGameDef * gamedef)
virtual

Implements TestBase.

References IGameDef::getItemDefManager(), TEST, and testSerializeDeserialize().

+ Here is the call graph for this function:

◆ testSerializeDeserialize()

void TestInventory::testSerializeDeserialize ( IItemDefManager * idef)

References ItemStack::count, Inventory::deSerialize(), InventoryList::getItem(), Inventory::getList(), InventoryList::getWidth(), Inventory::serialize(), serialized_inventory_in, serialized_inventory_inc, serialized_inventory_out, Inventory::setModified(), InventoryList::setName(), InventoryList::setWidth(), InventoryList::takeItem(), 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

◆ serialized_inventory_in

const char * TestInventory::serialized_inventory_in
static
Initial value:
=
"List 0 10\n"
"Width 3\n"
"Empty\n"
"Empty\n"
"Item default:cobble 61\n"
"Empty\n"
"Empty\n"
"Item default:dirt 71\n"
"Empty\n"
"Item default:dirt 99\n"
"Item default:cobble 38\n"
"Empty\n"
"EndInventoryList\n"
"List abc 1\n"
"Item default:stick 3\n"
"Width 0\n"
"EndInventoryList\n"
"EndInventory\n"

Referenced by testSerializeDeserialize().

◆ serialized_inventory_inc

const char * TestInventory::serialized_inventory_inc
static
Initial value:
=
"KeepList main\n"
"KeepList abc\n"
"EndInventory\n"

Referenced by testSerializeDeserialize().

◆ serialized_inventory_out

const char * TestInventory::serialized_inventory_out
static
Initial value:
=
"List main 10\n"
"Width 5\n"
"Empty\n"
"Empty\n"
"Item default:cobble 61\n"
"Empty\n"
"Empty\n"
"Item default:dirt 71\n"
"Empty\n"
"Item default:dirt 99\n"
"Item default:cobble 38\n"
"Empty\n"
"EndInventoryList\n"
"List abc 1\n"
"Width 0\n"
"Item default:stick 3\n"
"EndInventoryList\n"
"EndInventory\n"

Referenced by testSerializeDeserialize().


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