2014-06-29 23:14:46 +02:00
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <objects/CharacterObject.hpp>
|
|
|
|
#include "test_globals.hpp"
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(ItemTests)
|
2016-06-16 22:11:55 +02:00
|
|
|
|
|
|
|
#if RW_TEST_WITH_DATA
|
2016-09-09 22:13:22 +02:00
|
|
|
BOOST_AUTO_TEST_CASE(test_character_inventory) {
|
|
|
|
{
|
|
|
|
auto character = Global::get().e->createPedestrian(1, {0.f, 0.f, 0.f});
|
|
|
|
BOOST_REQUIRE(character != nullptr);
|
2014-06-29 23:14:46 +02:00
|
|
|
|
2016-10-19 03:22:33 +02:00
|
|
|
character->addToInventory(1, 10);
|
2016-04-15 02:06:10 +02:00
|
|
|
|
2016-10-19 03:22:33 +02:00
|
|
|
BOOST_CHECK_EQUAL(character->getActiveItem(), 0);
|
2014-06-29 23:14:46 +02:00
|
|
|
|
2016-10-19 03:22:33 +02:00
|
|
|
character->setActiveItem(1);
|
2014-06-29 23:14:46 +02:00
|
|
|
|
2016-10-19 03:22:33 +02:00
|
|
|
BOOST_CHECK_EQUAL(character->getActiveItem(), 1);
|
2016-05-02 18:38:04 +02:00
|
|
|
|
2016-10-19 03:22:33 +02:00
|
|
|
character->removeFromInventory(1);
|
2014-06-29 23:14:46 +02:00
|
|
|
|
2016-10-19 03:22:33 +02:00
|
|
|
BOOST_CHECK_EQUAL(character->getActiveItem(), 0);
|
2014-06-29 23:14:46 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
Global::get().e->destroyObject(character);
|
|
|
|
}
|
2014-06-29 23:14:46 +02:00
|
|
|
}
|
2016-06-16 22:11:55 +02:00
|
|
|
#endif
|
2014-06-29 23:14:46 +02:00
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|