16 #define GETTEXT_DOMAIN "wesnoth-test" 23 #include <boost/test/unit_test.hpp> 28 dummy_action(std::size_t team_index,
bool hidden,
int id):
action(team_index, hidden), id_(id) {}
32 std::ostream&
print(std::ostream&
s)
const { s<<id_;
return s; }
35 void execute(
bool& success,
bool& complete){ success=
true; complete=
true; }
50 std::shared_ptr<dummy_action> dact;
53 std::shared_ptr<dummy_action> act1(
new dummy_action(0,
false, 1));
54 std::shared_ptr<dummy_action> act2(
new dummy_action(0,
false, 2));
55 std::shared_ptr<dummy_action> act3(
new dummy_action(0,
false, 3));
66 BOOST_REQUIRE(dact = std::dynamic_pointer_cast<dummy_action>(act));
67 BOOST_REQUIRE(dact->id_ == tmp);
71 std::shared_ptr<dummy_action> act4(
new dummy_action(0,
false, 4));
72 std::shared_ptr<dummy_action> act5(
new dummy_action(0,
false, 5));
73 std::shared_ptr<dummy_action> act6(
new dummy_action(0,
false, 6));
74 std::shared_ptr<dummy_action> act7(
new dummy_action(0,
false, 7));
75 std::shared_ptr<dummy_action> act8(
new dummy_action(0,
false, 8));
87 BOOST_REQUIRE(dact = std::dynamic_pointer_cast<dummy_action>(act));
88 BOOST_REQUIRE(dact->id_ == tmp);
91 BOOST_REQUIRE(dact = std::dynamic_pointer_cast<dummy_action>(*sac.
turn_begin(1)));
92 BOOST_REQUIRE(dact->id_ == 5);
94 BOOST_REQUIRE(dact = std::dynamic_pointer_cast<dummy_action>(*(1+sac.
turn_begin(1))));
95 BOOST_REQUIRE(dact->id_ == 6);
104 std::shared_ptr<dummy_action> dact;
106 std::shared_ptr<dummy_action> act1(
new dummy_action(0,
false, 1));
107 std::shared_ptr<dummy_action> act2(
new dummy_action(0,
false, 2));
108 std::shared_ptr<dummy_action> act3(
new dummy_action(0,
false, 3));
109 std::shared_ptr<dummy_action> act4(
new dummy_action(0,
false, 4));
110 std::shared_ptr<dummy_action> act5(
new dummy_action(0,
false, 5));
111 std::shared_ptr<dummy_action> act6(
new dummy_action(0,
false, 6));
126 for(
int i=1;
i<6;
i+=2, ++it){
127 BOOST_REQUIRE(dact = std::dynamic_pointer_cast<dummy_action>(*it));
128 BOOST_REQUIRE(dact->id_ ==
i);
132 BOOST_AUTO_TEST_SUITE_END()
container::iterator iterator
std::ostream & print(std::ostream &s) const
unit_ptr get_unit() const
Return the unit targeted by this action.
std::shared_ptr< unit > unit_ptr
iterator erase(iterator position)
Deletes the action at the specified position.
dummy_action(std::size_t team_index, bool hidden, int id)
BOOST_AUTO_TEST_SUITE(filesystem)
error check_validity() const
Check the validity of the action.
void draw_hex(const map_location &)
Gets called by display when drawing a hex, to allow actions to draw to the screen.
Contains typedefs for the whiteboard.
std::shared_ptr< action > action_ptr
map_location get_numbering_hex() const
BOOST_AUTO_TEST_CASE(test_insertion)
Encapsulates the map of the game.
void apply_temp_modifier(unit_map &)
Applies temporarily the result of this action to the specified unit map.
Datastructure holding the actions of a side on multiple turns.
static map_location::DIRECTION s
std::size_t turn_size(std::size_t turn_num) const
Returns the number of actions planned for turn turn_num.
std::shared_ptr< dummy_action > shared_from_this()
fake_unit_ptr get_fake_unit()
iterator turn_begin(std::size_t turn_num)
Returns the iterator for the first (executed earlier) action of a given turn within the actions queue...
iterator begin()
Returns the iterator for the first (executed earlier) action within the actions queue.
void execute(bool &success, bool &complete)
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
iterator insert(iterator position, action_ptr action)
Inserts an action at the specified position.
Container associating units to locations.
Dialog was closed with the OK button.
visitor is an abstract interface : action.accept(visitor) calls visitor.visit(action) ...
Abstract base class for all the whiteboard planned actions.
iterator turn_end(std::size_t turn_num)
iterator queue(std::size_t turn_num, action_ptr action)
Queues an action to be executed last.
Holds a temporary unit that can be drawn on the map without being placed in the unit_map.
std::size_t num_turns() const
Returns the number of turns that have plans.
void remove_temp_modifier(unit_map &)
Removes the result of this action from the specified unit map.
Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses...