mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 10:22:52 +01:00
5c78930c1b
They served no purpose other than to awkwardly implement weapon firing This is now handled in the Weapon::fire* functions, and everything else has been changed to reference weapon data or inventory indices directly
31 lines
738 B
C++
31 lines
738 B
C++
#include <boost/test/unit_test.hpp>
|
|
#include <objects/CharacterObject.hpp>
|
|
#include "test_globals.hpp"
|
|
|
|
BOOST_AUTO_TEST_SUITE(ItemTests)
|
|
|
|
#if RW_TEST_WITH_DATA
|
|
BOOST_AUTO_TEST_CASE(test_character_inventory) {
|
|
{
|
|
auto character = Global::get().e->createPedestrian(1, {0.f, 0.f, 0.f});
|
|
BOOST_REQUIRE(character != nullptr);
|
|
|
|
character->addToInventory(1, 10);
|
|
|
|
BOOST_CHECK_EQUAL(character->getActiveItem(), 0);
|
|
|
|
character->setActiveItem(1);
|
|
|
|
BOOST_CHECK_EQUAL(character->getActiveItem(), 1);
|
|
|
|
character->removeFromInventory(1);
|
|
|
|
BOOST_CHECK_EQUAL(character->getActiveItem(), 0);
|
|
|
|
Global::get().e->destroyObject(character);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|