forked from stefano-1981/vacuum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_test.cc
35 lines (30 loc) · 844 Bytes
/
map_test.cc
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
#include "map.h"
#include <cassert>
#include <vector>
#include "tests.h"
TEST(Map_AgentCannotMove) {
Map map(3, 3);
// The agent is in the only free position, (1, 1);
assert(map.AgentPosition() == Point({1, 1}));
for (const Direction d : std::vector<Direction>{Direction::UP,
Direction::DOWN,
Direction::LEFT,
Direction::RIGHT}) {
map.Update(d);
// Agent does not go anywhere.
assert(map.AgentPosition() == Point({1, 1}));
}
}
TEST(Map_CleanDirt) {
Map map(5, 5);
assert(map.AgentPosition() == Point({1, 1}));
map.SetDirt(2, 2);
map.SetDirtCount();
assert(map.CleanedRatio() == 0);
map.Update(Direction::DOWN);
assert(map.CleanedRatio() == 0);
map.Update(Direction::RIGHT);
assert(map.CleanedRatio() == 0);
map.Update(Direction::NONE);
assert(map.CleanedRatio() == 1);
}