2014-06-29 23:14:46 +02:00
|
|
|
#include <boost/test/unit_test.hpp>
|
|
|
|
#include <objects/CharacterObject.hpp>
|
2017-10-26 03:51:24 +02:00
|
|
|
#include "test_Globals.hpp"
|
2014-06-29 23:14:46 +02:00
|
|
|
|
2019-01-18 02:29:59 +01:00
|
|
|
BOOST_AUTO_TEST_SUITE(ItemsTests, DATA_TEST_PREDICATE)
|
2016-06-16 22:11:55 +02:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|