15 #define GETTEXT_DOMAIN "wesnoth-test"
22 #include <boost/test/unit_test.hpp>
31 std::ostream&
print(std::ostream&
s)
const { s<<
id_;
return s; }
34 void execute(
bool& success,
bool& complete){ success=
true; complete=
true; }
65 BOOST_REQUIRE(dact = boost::dynamic_pointer_cast<dummy_action>(act));
66 BOOST_REQUIRE(dact->id_ == tmp);
79 sac.insert(sac.turn_begin(1)+1, act6);
81 BOOST_REQUIRE(sac.num_turns() == 3);
86 BOOST_REQUIRE(dact = boost::dynamic_pointer_cast<dummy_action>(act));
87 BOOST_REQUIRE(dact->id_ == tmp);
90 BOOST_REQUIRE(dact = boost::dynamic_pointer_cast<dummy_action>(*sac.turn_begin(1)));
91 BOOST_REQUIRE(dact->id_ == 5);
93 BOOST_REQUIRE(dact = boost::dynamic_pointer_cast<dummy_action>(*(1+sac.turn_begin(1))));
94 BOOST_REQUIRE(dact->id_ == 6);
96 BOOST_REQUIRE(sac.turn_size(1) == 3);
97 BOOST_REQUIRE(3+sac.turn_begin(1) == sac.turn_end(1));
125 for(
int i=1;
i<6;
i+=2, ++it){
126 BOOST_REQUIRE(dact = boost::dynamic_pointer_cast<dummy_action>(*it));
127 BOOST_REQUIRE(dact->id_ ==
i);
131 BOOST_AUTO_TEST_SUITE_END()
container::iterator iterator
size_t num_turns() const
Returns the number of turns that have plans.
BOOST_AUTO_TEST_SUITE(test_map_location)
boost::shared_ptr< dummy_action > shared_from_this()
iterator erase(iterator position)
Deletes the action at the specified position.
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.
map_location get_numbering_hex() const
BOOST_AUTO_TEST_CASE(test_insertion)
unit_ptr get_unit() const
Return the unit targeted by this action.
Encapsulates the map of the game.
error check_validity() const
Check the validity of the action.
dummy_action(size_t team_index, bool hidden, int id)
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.
fake_unit_ptr get_fake_unit()
iterator begin()
Returns the iterator for the first (executed earlier) action within the actions queue.
boost::intrusive_ptr< unit > unit_ptr
void execute(bool &success, bool &complete)
Output parameters: success: Whether or not to continue an execute-all after this execution complete: ...
std::ostream & print(std::ostream &s) const
iterator insert(iterator position, action_ptr action)
Inserts an action at the specified position.
Container associating units to locations.
visitor is an abstract interface : action.accept(visitor) calls visitor.visit(action) ...
Abstract base class for all the whiteboard planned actions.
iterator queue(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.
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...