Coverage report for gui


src/
File: src/parser/Map.hpp
Date: 2024-06-25 10:57:02
Lines:
8/8
100.0%
Functions:
2/2
100.0%
Branches:
20/84
23.8%

Line Branch Exec Source
1 #ifndef MAP_HPP
2 #define MAP_HPP
3
4 #include <vector>
5
6 class Tile
7 {
8 private:
9 [[ maybe_unused ]] std::vector<int> pos = {0, 0};
10 std::vector<int> ressources = std::vector<int>(7, 0);
11 public:
12
1/2
✓ Branch 2 taken 454 times.
✗ Branch 3 not taken.
454 Tile(int x, int y) : pos(std::vector<int>({x, y})) {};
13
7/28
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 20 taken 1 times.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✓ Branch 24 taken 1 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
2162 ~Tile() {};
14
15
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 void setRessources(std::vector<int> values) { this->ressources = values; };
16
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<int> getRessources() { return ressources; };
17
8/46
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✓ Branch 21 taken 1 times.
✗ Branch 22 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✓ Branch 31 taken 1 times.
✗ Branch 32 not taken.
✗ Branch 35 not taken.
✗ Branch 36 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✓ Branch 41 taken 1 times.
✗ Branch 42 not taken.
✗ Branch 45 not taken.
✗ Branch 46 not taken.
✗ Branch 48 not taken.
✗ Branch 49 not taken.
✓ Branch 51 taken 1 times.
✗ Branch 52 not taken.
✗ Branch 55 not taken.
✗ Branch 56 not taken.
✗ Branch 58 not taken.
✗ Branch 59 not taken.
✓ Branch 61 taken 1 times.
✗ Branch 62 not taken.
✗ Branch 65 not taken.
✗ Branch 66 not taken.
✗ Branch 68 not taken.
✗ Branch 69 not taken.
9 int getResAt(int index) { return ressources.at(index); };
18 };
19
20
21
22 class Map
23 {
24 private:
25 std::vector<std::vector<Tile>> map = {};
26 public:
27 Map() {};
28 95 ~Map() {};
29
30 std::vector<int> getSize();
31 /**
32 * @brief Updates a tile on the map
33 * @param x The x position of the tile
34 * @param y The y position of the tile
35 * @param values The values to update the tile with
36 * @return void
37 */
38 void updateTile(int x, int y, std::vector<int> values);
39 /**
40 * @brief Fills the map with empty tiles
41 * @param x The heigth of the map
42 * @param y The width of the map
43 * @return void
44 */
45 void fillMap(int x, int y);
46
47
2/4
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
6 std::vector<std::vector<Tile>> getMap() { return this->map; };
48 12 Tile getTileAt(int x, int y) { return this->map.at(x).at(y); };
49
50 void resetMap();
51
52 };
53
54 #endif // MAP_HPP
55