-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer_test.cpp
49 lines (44 loc) · 1.09 KB
/
player_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <boost/test/unit_test.hpp>
#include "helper.h"
#include "player.h"
#include "game.h"
BOOST_AUTO_TEST_CASE(player_construction)
{
const amino_acid any_amino_acid = amino_acid::cysteine;
const double x{12.34};
const double y{23.45};
const player p(
any_amino_acid,
x,
y
);
BOOST_CHECK(p.get_amino_acid() == any_amino_acid);
BOOST_CHECK_EQUAL(p.get_x(), x);
BOOST_CHECK_EQUAL(p.get_y(), y);
}
BOOST_AUTO_TEST_CASE(tyrosine_has_shield_as_special_power)
{
BOOST_CHECK(get_power(amino_acid::tyrosine) == power_type::shield);
}
BOOST_AUTO_TEST_CASE(player_start_using_power_starts_using_power)
{
game g = create_test_game_1();
player& p = get_player(g, 0);
BOOST_CHECK(!p.is_using_power());
p.start_using_power();
BOOST_CHECK(p.is_using_power());
}
BOOST_AUTO_TEST_CASE(player_using_power_has_a_duration)
{
#ifdef FIX_ISSUE_30
game g = create_test_game_1();
player& p = get_player(g, 0);
p.start_using_power();
BOOST_CHECK(p.is_using_power());
for (int i=0; i!=100; ++i)
{
g.tick();
}
BOOST_CHECK(!p.is_using_power());
#endif // FIX_ISSUE_30
}