16 #include <boost/test/unit_test.hpp>
32 "random_traits",
false,
43 orc1->set_name(
"Larry");
44 orc2->set_name(
"Moe");
46 orc1->set_id(
"larry");
50 BOOST_CHECK_EQUAL(recall_man.
size(), 0);
51 BOOST_CHECK_MESSAGE(recall_man.
begin() == recall_man.
end(),
"failed begin() == end() for an empty container");
54 BOOST_CHECK_EQUAL(recall_man.
size(), 1);
55 BOOST_CHECK_MESSAGE(recall_man[0] == orc1,
"unexpected result at index [0]");
56 BOOST_CHECK_MESSAGE(recall_man.
find_if_matches_id(
"larry") == orc1,
"found something unexpected");
57 BOOST_CHECK_MESSAGE(!recall_man.
find_if_matches_id(
"moe"),
"found something unexpected");
60 BOOST_CHECK_EQUAL(recall_man.
size(), 2);
61 BOOST_CHECK_MESSAGE(recall_man[0] == orc1,
"unexpected result at index [0]");
62 BOOST_CHECK_MESSAGE(recall_man[1] == orc2,
"unexpected result at index [1]");
63 BOOST_CHECK_MESSAGE(recall_man.
find_if_matches_id(
"larry") == orc1,
"found something unexpected");
64 BOOST_CHECK_MESSAGE(recall_man.
find_if_matches_id(
"moe") == orc2,
"found something unexpected");
67 BOOST_CHECK_EQUAL(recall_man.
size(), 1);
68 BOOST_CHECK_MESSAGE(recall_man[0] == orc2,
"unexpected result at index [0]");
69 BOOST_CHECK_MESSAGE(!recall_man.
find_if_matches_id(
"larry"),
"found something unexpected");
70 BOOST_CHECK_MESSAGE(recall_man.
find_if_matches_id(
"moe") == orc2,
"found something unexpected");
73 BOOST_CHECK_EQUAL(recall_man.
size(), 2);
74 BOOST_CHECK_MESSAGE(recall_man[0] == orc2,
"unexpected result at index [0]");
75 BOOST_CHECK_MESSAGE(recall_man[1] == orc1,
"unexpected result at index [1]");
76 BOOST_CHECK_MESSAGE(recall_man.
find_if_matches_id(
"larry") == orc1,
"found something unexpected");
77 BOOST_CHECK_MESSAGE(recall_man.
find_if_matches_id(
"moe") == orc2,
"found something unexpected");
81 BOOST_AUTO_TEST_SUITE_END()
A config object defines a single node in a WML file, with access to child nodes.
This class encapsulates the recall list of a team.
std::size_t size() const
Get the number of units on the list.
void add(const unit_ptr &ptr, int pos=-1)
Add a unit to the list.
unit_ptr find_if_matches_id(const std::string &unit_id)
Find a unit by id.
iterator end()
end iterator
iterator begin()
begin iterator
void erase_if_matches_id(const std::string &unit_id)
Erase any unit with this id.
void build_unit_type(const unit_type &ut, unit_type::BUILD_STATUS status) const
Makes sure the provided unit_type is built to the specified level.
A single unit type that the player may recruit.
static unit_ptr create(const config &cfg, bool use_traits=false, const vconfig *vcfg=nullptr)
Initializes a unit from a config.
Definitions for the interface to Wesnoth Markup Language (WML).
Game configuration data as global variables.
std::shared_ptr< unit > unit_ptr
BOOST_AUTO_TEST_SUITE(filesystem)
BOOST_AUTO_TEST_CASE(test_1)
unit_type_data unit_types