• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ParadoxGameConverters / Vic3ToHoI4 / 15945857949

22 Jun 2025 09:47PM UTC coverage: 94.151%. Remained the same
15945857949

push

github

web-flow
Update commons and simplify (#730)

* Update to draft commons.

* Build fixes.

* Strip redundant conversions to path

* Correct tests for on linux

* Try another folder that's blocked.

* Use draft fronter

* Update to merged

315 of 316 new or added lines in 40 files covered. (99.68%)

200 existing lines in 6 files now uncovered.

21826 of 23182 relevant lines covered (94.15%)

57153.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.79
/src/maps/map_data_tests.cpp
1
#include <external/commonItems/ModLoader/ModFilesystem.h>
2
#include <external/commonItems/external/googletest/googlemock/include/gmock/gmock-matchers.h>
3
#include <external/commonItems/external/googletest/googletest/include/gtest/gtest.h>
4

5
#include <optional>
6

7
#include "src/maps/map_data.h"
8
#include "src/maps/map_data_importer.h"
9

10

11

12
namespace
13
{
14

15
class MapsMapdata: public ::testing::Test
16
{
17
  protected:
18
   static void SetUpTestSuite()
1✔
19
   {
20
      const commonItems::ModFilesystem mod_filesystem("test_files/maps", {});
1✔
21
      const maps::ProvinceDefinitions province_definitions({.color_to_province_map = {
22
                                                                {0x88'00'15, "1"},  // the dark red one on top
×
23
                                                                {0xED'1C'24, "2"},  // the red red one on the left
×
24
                                                                {0x22'B1'4C, "3"},  // the green one in the middle
×
UNCOV
25
                                                                {0xFF'7F'27, "4"},  // the orange one on the right
×
UNCOV
26
                                                                {0xFF'F2'00, "5"},  // the yellow red one below
×
UNCOV
27
                                                                {0x3F'48'CC, "6"},  // the indigo one on the far right
×
UNCOV
28
                                                                {0xA3'49'A4, "7"},  // the purple one on the far right
×
29
                                                            }});
8✔
30
      maps::MapDataImporter importer(province_definitions);
1✔
31

32
      map_data = importer.ImportMapData(mod_filesystem);
1✔
33
   }
10✔
34

35
   static maps::MapData map_data;
36
};
37

38

39
maps::MapData MapsMapdata::map_data;
40

41
}  // namespace
42

43

44
namespace maps
45
{
46

47
TEST_F(MapsMapdata, ExceptionThrownForMissingProvincesBmp)
4✔
48
{
49
   const commonItems::ModFilesystem mod_filesystem("", {});
1✔
50
   const ProvinceDefinitions province_definitions;
1✔
51
   MapDataImporter importer(province_definitions);
1✔
52

53
   EXPECT_THROW(importer.ImportMapData(mod_filesystem), std::runtime_error);
1✔
54
}
1✔
55

56

57
TEST_F(MapsMapdata, ExceptionThrownForMissingAdjacenciesCsv)
4✔
58
{
59
   const commonItems::ModFilesystem mod_filesystem("test_files/maps/nocsv", {});
1✔
60
   const ProvinceDefinitions province_definitions;
1✔
61
   MapDataImporter importer(province_definitions);
1✔
62

63
   EXPECT_THROW(importer.ImportMapData(mod_filesystem), std::runtime_error);
1✔
64
}
1✔
65

66

67
TEST_F(MapsMapdata, NeighborsDefined)
4✔
68
{
69
   EXPECT_THAT(map_data.GetNeighbors("42"), testing::UnorderedElementsAre());        // non-existent province
1✔
70
   EXPECT_THAT(map_data.GetNeighbors("x000042"), testing::UnorderedElementsAre());   // non-existent province
1✔
71
   EXPECT_THAT(map_data.GetNeighbors("1"), testing::UnorderedElementsAre("3"));      // defined from above
1✔
72
   EXPECT_THAT(map_data.GetNeighbors("2"), testing::UnorderedElementsAre("3"));      // defined from right
1✔
73
   EXPECT_THAT(map_data.GetNeighbors("4"), testing::UnorderedElementsAre("3"));      // defined from left
1✔
74
   EXPECT_THAT(map_data.GetNeighbors("5"), testing::UnorderedElementsAre("3"));      // defined from above
1✔
75
   EXPECT_THAT(map_data.GetNeighbors("101"), testing::UnorderedElementsAre("102"));  // non-impassable adjacency
1✔
76
   EXPECT_THAT(map_data.GetNeighbors("xD00000"),
1✔
77
       testing::UnorderedElementsAre("x8CC57E"));                             // non-impassable adjacency
1✔
78
   EXPECT_THAT(map_data.GetNeighbors("6"), testing::UnorderedElementsAre());  // impossible adjacency removes neighbor
1✔
79
}
1✔
80

81

82
TEST_F(MapsMapdata, SpecifiedBordersCanBeLookedUp)
4✔
83
{
84
   EXPECT_EQ(map_data.GetSpecifiedBorderCenter("42", "x000001"), std::nullopt);  // non-existent province
1✔
85
   EXPECT_EQ(map_data.GetSpecifiedBorderCenter("1", "x000005"), std::nullopt);   // non-bordering provinces
1✔
86

87
   // Bordering provinces
88
   const auto border_point = map_data.GetSpecifiedBorderCenter("1", "3");
1✔
89
   ASSERT_TRUE(border_point);
1✔
90
   constexpr Point expected_point{13, 591};  // y-axis is from the bottom
1✔
91
   EXPECT_EQ(*border_point, expected_point);
1✔
92

93
   // Impassable border for bordering provinces
94
   const auto impassable_border_point = map_data.GetSpecifiedBorderCenter("6", "7");
1✔
95
   ASSERT_TRUE(impassable_border_point);
1✔
96

97
   constexpr Point expected_impassable_point{44, 586};  // y-axis is from the bottom
1✔
98
   EXPECT_EQ(*impassable_border_point, expected_impassable_point);
1✔
99
}
100

101

102
TEST_F(MapsMapdata, AnyBordersCanBeLookedUp)
4✔
103
{
104
   EXPECT_EQ(map_data.GetAnyBorderCenter("42"), std::nullopt);  // nonexistent province
1✔
105
   EXPECT_EQ(map_data.GetAnyBorderCenter("8"), std::nullopt);   // province with no borders
1✔
106

107
   // bordering provinces
108
   const auto border_point = map_data.GetAnyBorderCenter("3");
1✔
109
   ASSERT_TRUE(border_point);
1✔
110

111
   constexpr Point expected_point{13, 590};  // y-axis is from the bottom
1✔
112
   EXPECT_EQ(*border_point, expected_point);
1✔
113
}
114

115

116
TEST_F(MapsMapdata, CentralPointCanBeLookedUp)
4✔
117
{
118
   const auto central_point = map_data.GetCentermostPoint("3");
1✔
119

120
   EXPECT_EQ(central_point, std::make_optional(Point{13, 586}));
1✔
121
}
1✔
122

123

124
TEST_F(MapsMapdata, NulloptForNoCentralPoint)
4✔
125
{
126
   const auto central_point = map_data.GetCentermostPoint("42");
1✔
127

128
   EXPECT_EQ(central_point, std::nullopt);
1✔
129
}
1✔
130

131

132
TEST_F(MapsMapdata, ProvinceNamesCanBeLookedUp)
4✔
133
{
134
   EXPECT_EQ(map_data.GetProvinceName({0, 0}), std::nullopt);  // undefined points
1✔
135

136
   // defined points
137
   const auto province_name = map_data.GetProvinceName({13, 595});
1✔
138
   ASSERT_TRUE(province_name);
1✔
139
   EXPECT_EQ(*province_name, "1");
1✔
140
}
1✔
141

142

143
TEST_F(MapsMapdata, ProvincePointsCanBeLookedUp)
4✔
144
{
145
   EXPECT_EQ(map_data.GetProvincePoints("42"), std::nullopt);  // undefined province
1✔
146

147
   // defined province
148
   const auto provincePoints = map_data.GetProvincePoints("1");
1✔
149
   ASSERT_TRUE(provincePoints);
1✔
150

151
   constexpr Point expected_point{13, 595};
1✔
152
   EXPECT_EQ(provincePoints->GetCentermostPoint(), expected_point);
1✔
153
}
1✔
154

155
}  // namespace maps
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc