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

ParadoxGameConverters / Vic3ToHoI4 / 16148072694

08 Jul 2025 03:49PM UTC coverage: 94.191% (-0.02%) from 94.211%
16148072694

Pull #736

github

web-flow
Merge 4b596389a into 872e54c95
Pull Request #736: Add a clang-tidy configuration

88 of 107 new or added lines in 34 files covered. (82.24%)

22 existing lines in 6 files now uncovered.

22002 of 23359 relevant lines covered (94.19%)

56720.31 hits per line

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

83.37
/src/hoi4_world/world/hoi4_world_converter_tests.cpp
1
#include <external/commonItems/external/googletest/googlemock/include/gmock/gmock-matchers.h>
2
#include <external/commonItems/external/googletest/googletest/include/gtest/gtest.h>
3
#include <external/fmt/include/fmt/format.h>
4

5
#include <sstream>
6

7
#include "hoi4_world_framework_builder.h"
8
#include "src/hoi4_world/countries/hoi4_country.h"
9
#include "src/hoi4_world/world/hoi4_world.h"
10
#include "src/hoi4_world/world/hoi4_world_converter.h"
11
#include "src/mappers/country/country_mapper.h"
12
#include "src/mappers/provinces/province_mapper.h"
13
#include "src/mappers/world/world_mapper_builder.h"
14
#include "src/maps/province_definitions.h"
15
#include "src/vic3_world/characters/vic3_character.h"
16
#include "src/vic3_world/countries/vic3_country.h"
17
#include "src/vic3_world/provinces/vic3_province_definitions.h"
18
#include "src/vic3_world/world/vic3_world.h"
19

20

21

22
namespace hoi4
23
{
24

25
TEST(Hoi4worldWorldHoi4worldconverter, EmptyWorldIsEmpty)
4✔
26
{
27
   const vic3::World source_world(vic3::WorldOptions{});
1✔
28
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper().Build();
1✔
29

30
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world", {}),
2✔
31
       source_world,
32
       world_mapper,
33
       std::async<>(std::launch::async, []() {
3✔
34
          return hoi4::WorldFrameworkBuilder::CreateNullWorldFramework().Build();
2✔
35
       }));
1✔
36

37
   EXPECT_TRUE(world.GetCountries().empty());
1✔
38
   EXPECT_TRUE(world.GetStates().states.empty());
1✔
39
   EXPECT_TRUE(world.GetStates().province_to_state_id_map.empty());
1✔
40
   EXPECT_TRUE(world.GetCharacters().empty());
1✔
41
}
3✔
42

43

44
TEST(Hoi4worldWorldHoi4worldconverter, CountriesAreConverted)
4✔
45
{
46
   const vic3::Country source_country_one({
47
       .number = 1,
48
       .tag = "TAG",
49
       .color = commonItems::Color{std::array{1, 2, 3}},
50
       .head_of_state_id = 1,
51
       .character_ids = {1},
52
   });
2✔
53
   const vic3::Country source_country_two({
54
       .number = 3,
55
       .tag = "TWO",
56
       .color = commonItems::Color{std::array{2, 4, 6}},
57
       .head_of_state_id = 3,
58
       .character_ids = {2, 3},
59
   });
1✔
60

61
   vic3::Character character_one({.id = 1});  // Compiler was being weird about it directly in map
1✔
62
   vic3::Character character_two({.id = 2, .roles = {"agitator"}});
2✔
63
   vic3::Character character_three({.id = 3});
1✔
64
   const vic3::World source_world({
65
       .countries = {{1, source_country_one}, {3, source_country_two}},
×
66
       .states = {},
67
       .acquired_technologies =
68
           {
69
               {1, {"source_tech"}},
×
70
               {3, {"source_tech_two", "source_tech_three"}},
×
71
           },
72
       .characters =
73
           {
74
               {1, character_one},
×
75
               {2, character_two},
×
76
               {3, character_three},
×
77
           },
78
   });
11✔
79

80
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
81
                                                 .AddCountries({{1, "TAG"}, {3, "TWO"}})
4✔
82
                                                 .DefaultTechMapper()
1✔
83
                                                 .Build();
1✔
84
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world", {}),
2✔
85
       source_world,
86
       world_mapper,
87
       std::async<>(std::launch::async, []() {
3✔
88
          return hoi4::WorldFrameworkBuilder::CreateNullWorldFramework().Build();
2✔
89
       }));
1✔
90

91
   const Technologies expected_techs_one{std::map<std::optional<std::string>, std::set<std::string>>{
4✔
92
       {std::nullopt, std::set<std::string>{"dest_tech_one", "dest_tech_two"}}}};
7✔
93
   const Technologies expected_techs_two{std::map<std::optional<std::string>, std::set<std::string>>{
4✔
94
       {R"(not = { has_dlc = "Test DLC" })", std::set<std::string>{"dest_tech_three"}}}};
6✔
95
   const std::vector<EquipmentVariant> expected_legacy_ship_variants_one = {
96
       EquipmentVariant("Test Legacy Ship Variant Three", "", {}, {"dest_technology_two"}, {}),
1✔
97
       EquipmentVariant("Test Legacy Ship Variant Four", "", {}, {"dest_technology_four"}, {}),
1✔
98
   };
3✔
99
   const std::vector<EquipmentVariant> expected_legacy_ship_variants_two = {
100
       EquipmentVariant("Test Legacy Ship Variant Three", "", {}, {"dest_technology_two"}, {}),
1✔
101
       EquipmentVariant("Test Legacy Ship Variant Four", "", {}, {"dest_technology_four"}, {}),
1✔
102
   };
3✔
103
   const std::vector<EquipmentVariant> expected_ship_variants_one = {
104
       EquipmentVariant("Test Ship Variant Three", "", {}, {"dest_technology_two"}, {}),
1✔
105
       EquipmentVariant("Test Ship Variant Four", "", {}, {"dest_technology_four"}, {}),
1✔
106
   };
3✔
107
   const std::vector<EquipmentVariant> expected_ship_variants_two = {
108
       EquipmentVariant("Test Ship Variant Three", "", {}, {"dest_technology_two"}, {}),
1✔
109
       EquipmentVariant("Test Ship Variant Four", "", {}, {"dest_technology_four"}, {}),
1✔
110
   };
3✔
111
   const std::vector<EquipmentVariant> expected_plane_variants_one = {
112
       EquipmentVariant("Test Plane Design Three", "", {}, {"dest_technology_two"}, {}),
1✔
113
       EquipmentVariant("Test Plane Design Four", "", {}, {"dest_technology_four"}, {}),
1✔
114
   };
3✔
115
   const std::vector<EquipmentVariant> expected_plane_variants_two = {
116
       EquipmentVariant("Test Plane Design Three", "", {}, {"dest_technology_two"}, {}),
1✔
117
       EquipmentVariant("Test Plane Design Four", "", {}, {"dest_technology_four"}, {}),
1✔
118
   };
3✔
119
   const std::vector<EquipmentVariant> expected_tank_variants_one = {
120
       EquipmentVariant("Test Tank Design Three", "", {}, {"dest_technology_two"}, {}),
1✔
121
       EquipmentVariant("Test Tank Design Four", "", {}, {"dest_technology_four"}, {}),
1✔
122
   };
3✔
123
   const std::vector<EquipmentVariant> expected_tank_variants_two = {
124
       EquipmentVariant("Test Tank Design Three", "", {}, {"dest_technology_two"}, {}),
1✔
125
       EquipmentVariant("Test Tank Design Four", "", {}, {"dest_technology_four"}, {}),
1✔
126
   };
3✔
127

128
   EXPECT_THAT(world.GetCountries(),
6✔
129
       testing::ElementsAre(testing::Pair("TAG",
130
                                Country(CountryOptions{
131
                                    .source_country_number = 1,
132
                                    .tag = "TAG",
133
                                    .color = commonItems::Color{std::array{1, 2, 3}},
134
                                    .ideology_support = {{"neutrality", 100}},
135
                                    .technologies = expected_techs_one,
136
                                    .legacy_ship_variants = expected_legacy_ship_variants_one,
137
                                    .ship_variants = expected_ship_variants_one,
138
                                    .plane_variants = expected_plane_variants_one,
139
                                    .tank_variants = expected_tank_variants_one,
140
                                    .character_ids = {1},
141
                                    .starting_research_slots = 3,
142
                                })),
143
           testing::Pair("TWO",
144
               Country(CountryOptions{
145
                   .source_country_number = 3,
146
                   .tag = "TWO",
147
                   .color = commonItems::Color{std::array{2, 4, 6}},
148
                   .ideology_support = {{"neutrality", 100}},
149
                   .technologies = expected_techs_two,
150
                   .legacy_ship_variants = expected_legacy_ship_variants_two,
151
                   .ship_variants = expected_ship_variants_two,
152
                   .plane_variants = expected_plane_variants_two,
153
                   .tank_variants = expected_tank_variants_two,
154
                   .character_ids = {3},
155
                   .spy_ids = {2},
156
                   .starting_research_slots = 3,
157
               }))));
1✔
158
}
53✔
159

160

161
TEST(Hoi4worldWorldHoi4worldconverter, StatesAreConverted)
4✔
162
{
163
   const std::map<std::string, vic3::StateRegion> state_regions({{"STATE_ONE",
164
       vic3::StateRegion(
8✔
165
           {
166
               {"x000005", "city"},
167
               {"x000004", "port"},
168
               {"x000003", "farm"},
169
               {"x000002", "mine"},
170
               {"x000001", "wood"},
171
           },
172
           {})}});
10✔
173
   const auto province_definitions = vic3::ProvinceDefinitions({
174
       "x000001",
175
       "x000002",
176
       "x000003",
177
       "x000004",
178
       "x000005",
179
       "x000006",
180
   });
7✔
181
   const vic3::Buildings vic3_buildings({
182
       {1, std::vector{vic3::Building("", 1, 875'000)}},
3✔
183
       {2, std::vector{vic3::Building("", 2, 700'000)}},
3✔
184
   });
3✔
185

186
   const vic3::World source_world(vic3::WorldOptions{
1✔
187
       .states =
188
           {
189
               {1, vic3::State({.owner_number = 1, .owner_tag = "TAG", .provinces = {1, 2, 3}})},
1✔
190
               {2, vic3::State({.owner_number = 2, .owner_tag = "TWO", .provinces = {4, 5, 6}})},
1✔
191
           },
192
       .state_regions = state_regions,
193
       .province_definitions = province_definitions,
194
       .buildings = vic3_buildings,
195
   });
2✔
196

197
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
198
                                                 .AddCountries({{1, "TAG"}, {2, "TWO"}})
4✔
199
                                                 .AddProvinces({
20✔
200
                                                     {"x000001", {10}},
×
201
                                                     {"x000002", {20}},
×
202
                                                     {"x000003", {30}},
×
203
                                                     {"x000004", {40}},
×
204
                                                     {"x000005", {50}},
×
205
                                                     {"x000006", {60}},
×
206
                                                 })
207
                                                 .Build();
1✔
208
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world", {}),
2✔
209
       source_world,
210
       world_mapper,
211
       std::async<>(std::launch::async, []() {
3✔
212
          return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
213
              commonItems::ModFilesystem("test_files/hoi4_world", {}))
2✔
214
              .Build();
2✔
215
       }));
1✔
216

217
   EXPECT_THAT(world.GetStates().states,
3✔
218
       testing::ElementsAre(State(1,
219
                                {.owner = "TAG",
220
                                    .provinces = {10, 20, 30},
221
                                    .category = "large_city",
222
                                    .victory_points = {{30, 3}},
223
                                    .civilian_factories = 3,
224
                                    .military_factories = 2,
225
                                    .air_base_level = 1}),
226
           State(2,
227
               {.owner = "TWO",
228
                   .provinces = {40, 50, 60},
229
                   .category = "city",
230
                   .victory_points = {{50, 2}},
231
                   .civilian_factories = 2,
232
                   .military_factories = 2,
233
                   .air_base_level = 1})));
1✔
234
   EXPECT_THAT(world.GetStates().province_to_state_id_map,
1✔
235
       testing::UnorderedElementsAre(testing::Pair(10, 1),
236
           testing::Pair(20, 1),
237
           testing::Pair(30, 1),
238
           testing::Pair(40, 2),
239
           testing::Pair(50, 2),
240
           testing::Pair(60, 2)));
1✔
241
}
31✔
242

243

244
TEST(Hoi4worldWorldHoi4worldconverter, CapitalsGetExtraVictoryPointValue)
4✔
245
{
246
   std::map<int, vic3::Country> countries;
1✔
247
   std::map<std::string, vic3::StateRegion> state_regions;
1✔
248
   std::vector<std::string> province_definitions_initializer;
1✔
249
   std::map<int, std::vector<vic3::Building>> buildings_initializer;
1✔
250
   std::map<int, int> scored_countries;
1✔
251
   std::map<int, vic3::State> vic3_states;
1✔
252

253
   mappers::WorldMapperBuilder mapperBuilder = mappers::WorldMapperBuilder::CreateNullMapper();
1✔
254
   for (int i = 1; i <= 80; ++i)
81✔
255
   {
256
      mapperBuilder.AddCountries({{i, fmt::format("X{:0>2}", i)}});
160✔
257
      countries.emplace(i,
80✔
258
          vic3::Country({
80✔
259
              .number = i,
260
              .tag = fmt::format("X{:0>2}", i),
261
              .capital_state = i,
262
          }));
263
      state_regions.emplace(fmt::format("STATE_{:0>2}", i),
80✔
264
          vic3::StateRegion(
400✔
265
              {
266
                  {fmt::format("x0000{:0>2}", i), "city"},
80✔
267
              },
268
              {}));
160✔
269
      province_definitions_initializer.emplace_back(fmt::format("x0000{:0>2}", i));
80✔
270
      buildings_initializer.emplace(i, std::vector{vic3::Building("", i, 1000.0f - i)});
160✔
271
      scored_countries.emplace(i, i);
80✔
272
      vic3_states.emplace(i,
80✔
273
          vic3::State({.owner_number = i, .owner_tag = fmt::format("x0000{:0>2}", i), .provinces = {i}}));
160✔
274
      mapperBuilder.AddProvinces({{fmt::format("x0000{:0>2}", i), i}});
160✔
275
   }
276
   const vic3::ProvinceDefinitions province_definitions(province_definitions_initializer);
1✔
277
   const vic3::Buildings buildings;
1✔
278
   const vic3::CountryRankings country_rankings({1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, scored_countries);
1✔
279

280
   const vic3::World source_world(vic3::WorldOptions{
1✔
281
       .countries = countries,
282
       .states = vic3_states,
283
       .state_regions = state_regions,
284
       .province_definitions = province_definitions,
285
       .buildings = buildings,
286
       .country_rankings = country_rankings,
287
   });
1✔
288

289
   const World world =
290
       ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world/CapitalsGetExtraVictoryPointValue", {}),
2✔
291
           source_world,
292
           mapperBuilder.Build(),
2✔
293
           std::async<>(std::launch::async, []() {
2✔
294
              return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
295
                  commonItems::ModFilesystem("test_files/hoi4_world/CapitalsGetExtraVictoryPointValue", {}))
2✔
296
                  .Build();
2✔
297
           }));
1✔
298

299
   // HoI4 states are in an arbitrary order compared to Vic3 states, so store by province number for the actual checks
300
   std::map<int, State> states;
1✔
301
   for (const auto& state: world.GetStates().states)
81✔
302
   {
303
      ASSERT_FALSE(state.GetProvinces().empty());
80✔
304
      const int province = *state.GetProvinces().begin();
80✔
305
      states.emplace(province, state);
80✔
306
   }
307

308
   // five great powers, first two have a VP of 50
309
   EXPECT_THAT(states.at(1).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(1, 50)));
1✔
310
   EXPECT_THAT(states.at(2).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(2, 50)));
1✔
311

312
   // remaining GPs have VPs worth 40
313
   EXPECT_THAT(states.at(3).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(3, 40)));
1✔
314
   EXPECT_THAT(states.at(4).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(4, 40)));
1✔
315
   EXPECT_THAT(states.at(5).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(5, 40)));
1✔
316

317
   // five major powers, first two have a VP of 30
318
   EXPECT_THAT(states.at(6).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(6, 30)));
1✔
319
   EXPECT_THAT(states.at(7).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(7, 30)));
1✔
320

321
   // remaining majors have VPs worth 25
322
   EXPECT_THAT(states.at(8).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(8, 25)));
1✔
323
   EXPECT_THAT(states.at(9).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(9, 25)));
1✔
324
   EXPECT_THAT(states.at(10).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(10, 25)));
1✔
325

326
   // the first 30 of the remaining countries have VPs worth 20
327
   for (int i = 11; i < 41; ++i)
31✔
328
   {
329
      EXPECT_THAT(states.at(i).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(i, 20)));
30✔
330
   }
331

332
   // the next 30 of the remaining countries have VPs worth 15
333
   for (int i = 41; i < 71; ++i)
31✔
334
   {
335
      EXPECT_THAT(states.at(i).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(i, 15)));
30✔
336
   }
337

338
   // the remaining countries have VPs worth 10
339
   for (int i = 71; i < 81; ++i)
11✔
340
   {
341
      EXPECT_THAT(states.at(i).GetVictoryPoints(), testing::UnorderedElementsAre(testing::Pair(i, 10)));
10✔
342
   }
343
}
563✔
344

345

346
TEST(Hoi4worldWorldHoi4worldconverter, CapitalsGetExtraAirBaseLevel)
4✔
347
{
348
   const vic3::Country source_country_one({
349
       .number = 1,
350
       .tag = "TAG",
351
       .color = commonItems::Color{std::array{1, 2, 3}},
352
       .head_of_state_id = 1,
353
       .character_ids = {1},
354
   });
2✔
355

356
   const std::map<std::string, vic3::StateRegion> state_regions({{"STATE_ONE",
357
       vic3::StateRegion(
8✔
358
           {
359
               {"x000005", "city"},
360
               {"x000004", "port"},
361
               {"x000003", "farm"},
362
               {"x000002", "mine"},
363
               {"x000001", "wood"},
364
           },
365
           {})}});
9✔
366
   const auto province_definitions = vic3::ProvinceDefinitions({
367
       "x000001",
368
       "x000002",
369
       "x000003",
370
       "x000004",
371
       "x000005",
372
       "x000006",
373
   });
7✔
374
   const vic3::Buildings vic3_buildings({
375
       {1, std::vector{vic3::Building("", 1, 0)}},
3✔
376
       {2, std::vector{vic3::Building("", 2, 0)}},
3✔
377
   });
3✔
378

379
   const vic3::World source_world(vic3::WorldOptions{
1✔
380
       .countries = {{1, source_country_one}},
×
381
       .states =
382
           {
383
               {1, vic3::State({.owner_number = 1, .owner_tag = "TAG", .provinces = {1, 2, 3}})},
1✔
384
               {2, vic3::State({.owner_number = 2, .owner_tag = "TWO", .provinces = {4, 5, 6}})},
1✔
385
           },
386
       .state_regions = state_regions,
387
       .province_definitions = province_definitions,
388
       .buildings = vic3_buildings,
389
   });
3✔
390

391
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
392
                                                 .AddCountries({{1, "TAG"}})
3✔
393
                                                 .AddProvinces({
20✔
394
                                                     {"x000001", {10}},
×
395
                                                     {"x000002", {20}},
×
396
                                                     {"x000003", {30}},
×
397
                                                     {"x000004", {40}},
×
398
                                                     {"x000005", {50}},
×
399
                                                     {"x000006", {60}},
×
400
                                                 })
401
                                                 .Build();
1✔
402
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world", {}),
2✔
403
       source_world,
404
       world_mapper,
405
       std::async<>(std::launch::async, []() {
3✔
406
          return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
407
              commonItems::ModFilesystem("test_files/hoi4_world", {}))
2✔
408
              .Build();
2✔
409
       }));
1✔
410

411
   EXPECT_THAT(world.GetStates().states,
3✔
412
       testing::ElementsAre(State(1,
413
                                {.owner = "TAG",
414
                                    .provinces = {10, 20, 30},
415
                                    .category = "rural",
416
                                    .victory_points = {{30, 1}},
417
                                    .air_base_level = 5}),
418
           State(2,
419
               {.provinces = {40, 50, 60}, .category = "rural", .victory_points = {{50, 1}}, .air_base_level = 0})));
1✔
420
}
33✔
421

422

423
TEST(Hoi4worldWorldHoi4worldconverter, StrategicRegionsAreCreated)
4✔
424
{
425
   const auto province_definitions = vic3::ProvinceDefinitions({
426
       "x000001",
427
       "x000002",
428
       "x000003",
429
       "x000004",
430
       "x000005",
431
       "x000006",
432
   });
7✔
433

434
   const vic3::World source_world({
435
       .states =
436
           {
437
               {1, vic3::State({.provinces = {1, 2, 3}})},
1✔
438
               {2, vic3::State({.provinces = {4, 5, 6}})},
1✔
439
           },
440
       .province_definitions = province_definitions,
441
   });
3✔
442
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
443
                                                 .AddProvinces({
20✔
444
                                                     {"x000001", {10}},
×
445
                                                     {"x000002", {20}},
×
446
                                                     {"x000003", {30}},
×
447
                                                     {"x000004", {40}},
×
448
                                                     {"x000005", {50}},
×
449
                                                     {"x000006", {60}},
×
450
                                                 })
451
                                                 .Build();
1✔
452

453
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world/StrategicRegionsAreCreated", {}),
2✔
454
       source_world,
455
       world_mapper,
456
       std::async<>(std::launch::async, []() {
3✔
457
          return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
458
              commonItems::ModFilesystem("test_files/hoi4_world/StrategicRegionsAreCreated", {}))
2✔
459
              .Build();
2✔
460
       }));
1✔
461

462
   const auto strategic_regions = world.GetStrategicRegions().GetStrategicRegions();
1✔
463
   ASSERT_TRUE(strategic_regions.contains(10));
1✔
464
   ASSERT_TRUE(strategic_regions.contains(50));
1✔
465

466
   const auto region_10 = strategic_regions.find(10)->second;
1✔
467
   EXPECT_EQ(region_10.GetFilename(), "strategic_region_10.txt");
1✔
468
   EXPECT_EQ(region_10.GetID(), 10);
1✔
469
   EXPECT_EQ(region_10.GetName(), "STRATEGICREGION_10");
1✔
470
   EXPECT_THAT(region_10.GetOldProvinces(), testing::UnorderedElementsAre(10, 20, 30, 40));
1✔
471
   EXPECT_THAT(region_10.GetNewProvinces(), testing::UnorderedElementsAre(10, 20, 30));
1✔
472
   EXPECT_TRUE(region_10.HasStaticModifiers());
1✔
473
   EXPECT_THAT(region_10.GetStaticModifiers(),
1✔
474
       testing::UnorderedElementsAre(testing::Pair("test_modifier", "always"),
475
           testing::Pair("test_modifier_two", "always")));
1✔
476
   ASSERT_TRUE(region_10.GetNavalTerrain().has_value());
1✔
477
   EXPECT_EQ(region_10.GetNavalTerrain().value(), "test_naval_terrain");
1✔
478
   EXPECT_EQ(region_10.GetWeather(),
1✔
479
       "= {\n"
480
       "\t\tperiod={\n"
481
       "\t\t\tbetween={ 0.0 30.0 }\n"
482
       "\t\t\ttemperature={ -6.0 12.0 }\n"
483
       "\t\t\tno_phenomenon=0.500\n"
484
       "\t\t\train_light=1.000\n"
485
       "\t\t\train_heavy=0.150\n"
486
       "\t\t\tsnow=0.200\n"
487
       "\t\t\tblizzard=0.000\n"
488
       "\t\t\tarctic_water=0.000\n"
489
       "\t\t\tmud=0.300\n"
490
       "\t\t\tsandstorm=0.000\n"
491
       "\t\t\tmin_snow_level=0.000\n"
492
       "\t\t}\n"
493
       "\t\tperiod={\n"
494
       "\t\t\tbetween={ 0.1 27.1 }\n"
495
       "\t\t\ttemperature={ -7.0 12.0 }\n"
496
       "\t\t\tno_phenomenon=0.500\n"
497
       "\t\t\train_light=1.000\n"
498
       "\t\t\train_heavy=0.150\n"
499
       "\t\t\tsnow=0.200\n"
500
       "\t\t\tblizzard=0.050\n"
501
       "\t\t\tarctic_water=0.000\n"
502
       "\t\t\tmud=0.300\n"
503
       "\t\t\tsandstorm=0.000\n"
504
       "\t\t\tmin_snow_level=0.000\n"
505
       "\t\t}\n"
506
       "\t}");
1✔
507

508
   const auto region_50 = strategic_regions.find(50)->second;
1✔
509
   EXPECT_EQ(region_50.GetFilename(), "strategic_region_50.txt");
1✔
510
   EXPECT_EQ(region_50.GetID(), 50);
1✔
511
   EXPECT_EQ(region_50.GetName(), "STRATEGICREGION_50");
1✔
512
   EXPECT_THAT(region_50.GetOldProvinces(), testing::UnorderedElementsAre(50, 60));
1✔
513
   EXPECT_THAT(region_50.GetNewProvinces(), testing::UnorderedElementsAre(40, 50, 60));
1✔
514
   EXPECT_FALSE(region_50.HasStaticModifiers());
1✔
515
   EXPECT_TRUE(region_50.GetStaticModifiers().empty());
1✔
516
   ASSERT_FALSE(region_50.GetNavalTerrain().has_value());
1✔
517
   EXPECT_TRUE(region_50.GetWeather().empty());
1✔
518

519
   EXPECT_THAT(world.GetStrategicRegions().GetProvinceToStrategicRegionMap(),
1✔
520
       testing::UnorderedElementsAre(testing::Pair(10, 10),
521
           testing::Pair(20, 10),
522
           testing::Pair(30, 10),
523
           testing::Pair(40, 50),
524
           testing::Pair(50, 50),
525
           testing::Pair(60, 50)));
1✔
526
   EXPECT_THAT(world.GetStrategicRegions().GetStrategicRegions().at(10).GetNewProvinces(),
1✔
527
       testing::UnorderedElementsAre(10, 20, 30));
1✔
528
   EXPECT_THAT(world.GetStrategicRegions().GetStrategicRegions().at(50).GetNewProvinces(),
1✔
529
       testing::UnorderedElementsAre(40, 50, 60));
1✔
530
}
21✔
531

532

533
TEST(Hoi4worldWorldHoi4worldconverter, BuildingsAreCreated)
4✔
534
{
535
   const auto province_definitions = vic3::ProvinceDefinitions({
536
       "x000001",
537
       "x000002",
538
       "x000003",
539
       "x000004",
540
       "x000005",
541
       "x000006",
542
       "x000007",
543
       "x000008",
544
   });
9✔
545

546
   const vic3::World source_world({
547
       .states =
548
           {
549
               {1, vic3::State({.provinces = {1, 2, 3, 4, 5}})},
1✔
550
               {2, vic3::State({.provinces = {6, 7}})},
1✔
551
               {3, vic3::State({.provinces = {8}})},
1✔
552
           },
553
       .province_definitions = province_definitions,
554
   });
4✔
555

556
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
557
                                                 .AddProvinces({
26✔
558
                                                     {{"x000001"}, 1},
×
559
                                                     {{"x000002"}, 2},
×
560
                                                     {{"x000003"}, 3},
×
561
                                                     {{"x000004"}, 4},
×
562
                                                     {{"x000005"}, 5},
×
563
                                                     {{"x000006"}, 6},
×
564
                                                     {{"x000007"}, 7},
×
565
                                                     {{"x000008"}, 8},
×
566
                                                 })
567
                                                 .Build();
1✔
568

569
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world/BuildingsAreCreated", {}),
2✔
570
       source_world,
571
       world_mapper,
572
       std::async<>(std::launch::async, []() {
3✔
573
          return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
574
              commonItems::ModFilesystem("test_files/hoi4_world/BuildingsAreCreated", {}))
2✔
575
              .Build();
2✔
576
       }));
1✔
577

578
   EXPECT_FALSE(world.GetBuildings().GetBuildings().empty());
1✔
579
}
27✔
580

581

582
TEST(Hoi4worldWorldHoi4worldconverter, RailwaysAreCreated)
4✔
583
{
584
   const vic3::StateRegion vic3_state_region({{"x000001", "city"}, {"x000002", "port"}, {"x000003", "mine"}}, {});
5✔
585

586
   const auto province_definitions = vic3::ProvinceDefinitions({
587
       "x000001",
588
       "x000002",
589
       "x000003",
590
       "x000004",
591
       "x000005",
592
       "x000006",
593
       "x000007",
594
       "x000008",
595
       "x000009",
596
       "x000010",
597
       "x000011",
598
       "x000012",
599
   });
13✔
600

601
   const std::map<int, std::vector<vic3::Building>> buildings = {
NEW
602
       {1, {vic3::Building(vic3::BuildingTypeNavalBase, 1, 0.0F, 5.0F, {})}},
×
603
   };
3✔
604

605
   const vic3::World source_world({.states =
606
                                       {
607
                                           {1,
×
608
                                               vic3::State({
1✔
609
                                                   .id = 1,
610
                                                   .owner_number = 1,
611
                                                   .owner_tag = "TAG",
612
                                                   .provinces = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
613
                                               })},
614
                                       },
615
       .state_regions =
616
           {
617
               {"state", vic3_state_region},
618
           },
619
       .province_definitions = province_definitions,
620
       .buildings = vic3::Buildings(buildings)});
3✔
621

622
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
623
                                                 .AddProvinces({
38✔
624
                                                     {"x000001", {1}},
×
625
                                                     {"x000002", {2}},
×
626
                                                     {"x000003", {3}},
×
627
                                                     {"x000004", {4}},
×
628
                                                     {"x000005", {5}},
×
629
                                                     {"x000006", {6}},
×
630
                                                     {"x000007", {7}},
×
631
                                                     {"x000008", {8}},
×
632
                                                     {"x000009", {9}},
×
633
                                                     {"x000010", {10}},
×
634
                                                     {"x000011", {11}},
×
635
                                                     {"x000012", {12}},
×
636
                                                 })
637
                                                 .Build();
1✔
638

639
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world/RailwaysAreCreated", {}),
2✔
640
       source_world,
641
       world_mapper,
642
       std::async<>(std::launch::async, []() {
3✔
643
          return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
644
              commonItems::ModFilesystem("test_files/hoi4_world/RailwaysAreCreated", {}))
2✔
645
              .Build();
2✔
646
       }));
1✔
647

648
   EXPECT_FALSE(world.GetRailways().railways.empty());
1✔
649
}
35✔
650

651

652
TEST(Hoi4worldWorldHoi4worldconverter, GreatPowersAreConverted)
4✔
653
{
654
   const vic3::World source_world({
655
       .countries =
656
           {
657
               {1, vic3::Country({})},
1✔
658
               {3, vic3::Country({})},
1✔
659
               {5, vic3::Country({})},
1✔
660
           },
661
       .country_rankings = {{1, 3, 5}, {}, {}},
662
   });
4✔
663
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
664
                                                 .AddCountries({
5✔
665
                                                     {1, "ONE"},
×
666
                                                     {3, "THR"},
×
667
                                                     {5, "FIV"},
1✔
668
                                                 })
669
                                                 .Build();
1✔
670

671
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world/RailwaysAreCreated", {}),
2✔
672
       source_world,
673
       world_mapper,
674
       std::async<>(std::launch::async, []() {
3✔
675
          return hoi4::WorldFrameworkBuilder::CreateNullWorldFramework().Build();
2✔
676
       }));
1✔
677

678
   EXPECT_THAT(world.GetGreatPowers(), testing::UnorderedElementsAre("ONE", "THR", "FIV"));
1✔
679
}
7✔
680

681

682
TEST(Hoi4worldWorldHoi4worldconverter, MajorPowersAreConverted)
4✔
683
{
684
   const vic3::World source_world({
685
       .countries =
686
           {
687
               {1, vic3::Country({})},
1✔
688
               {3, vic3::Country({})},
1✔
689
               {5, vic3::Country({})},
1✔
690
           },
691
       .country_rankings = {{}, {1, 3, 5}, {}},
692
   });
4✔
693

694
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
695
                                                 .AddCountries({
5✔
696
                                                     {1, "ONE"},
×
697
                                                     {3, "THR"},
×
698
                                                     {5, "FIV"},
1✔
699
                                                 })
700
                                                 .Build();
1✔
701

702
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world/RailwaysAreCreated", {}),
2✔
703
       source_world,
704
       world_mapper,
705
       std::async<>(std::launch::async, []() {
3✔
706
          return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
707
              commonItems::ModFilesystem("test_files/hoi4_world/RailwaysAreCreated", {}))
2✔
708
              .Build();
2✔
709
       }));
1✔
710

711
   EXPECT_THAT(world.GetMajorPowers(), testing::UnorderedElementsAre("ONE", "THR", "FIV"));
1✔
712
}
7✔
713

714

715
TEST(Hoi4worldWorldHoi4worldconverter, LocalizationsAreConverted)
4✔
716
{
717
   const vic3::Country source_country_one({
718
       .number = 1,
719
       .tag = "TAG",
720
       .color = commonItems::Color{std::array{1, 2, 3}},
721
   });
2✔
722
   const vic3::Country source_country_two({
723
       .number = 3,
724
       .tag = "THR",
725
       .color = commonItems::Color{std::array{2, 4, 6}},
726
   });
1✔
727
   const std::map<int, vic3::Country> source_countries = {{1, source_country_one}, {3, source_country_two}};
3✔
728

729
   const std::map<int, vic3::State> source_states = {
730
       {1, vic3::State({.owner_number = 1, .owner_tag = "TAG", .provinces = {1, 2, 3}})},
1✔
731
       {2, vic3::State({.owner_number = 2, .owner_tag = "TAG", .provinces = {4, 5, 6}})},
1✔
732
   };
3✔
733

734
   const std::map<std::string, vic3::StateRegion> source_state_regions = {
735
       {"REGION_ONE", vic3::StateRegion({{"x000001", "city"}}, {"x000001", "x000002", "x000003"})},
7✔
736
       {"REGION_TWO", vic3::StateRegion({{"x000004", "mine"}}, {"x000004", "x000005", "x000006"})},
7✔
737
   };
3✔
738

739
   commonItems::LocalizationDatabase vic3_localizations("english", {"spanish"});
2✔
740
   commonItems::LocalizationBlock country_block_one("TAG", "english");
1✔
741
   country_block_one.ModifyLocalization("english", "test");
1✔
742
   country_block_one.ModifyLocalization("spanish", "prueba");
1✔
743
   vic3_localizations.AddOrModifyLocalizationBlock("TAG", country_block_one);
1✔
744
   commonItems::LocalizationBlock country_adj_block_one("TAG_ADJ", "english");
1✔
745
   country_adj_block_one.ModifyLocalization("english", "testy");
1✔
746
   country_adj_block_one.ModifyLocalization("spanish", "pruebamente");
1✔
747
   vic3_localizations.AddOrModifyLocalizationBlock("TAG_ADJ", country_adj_block_one);
1✔
748
   commonItems::LocalizationBlock country_block_two("THR", "english");
1✔
749
   country_block_two.ModifyLocalization("english", "test three");
1✔
750
   country_block_two.ModifyLocalization("spanish", "prueba tres");
1✔
751
   vic3_localizations.AddOrModifyLocalizationBlock("THR", country_block_two);
1✔
752
   commonItems::LocalizationBlock country_adj_block_two("THR_ADJ", "english");
1✔
753
   country_adj_block_two.ModifyLocalization("english", "testy three");
1✔
754
   country_adj_block_two.ModifyLocalization("spanish", "pruebamente tres");
1✔
755
   vic3_localizations.AddOrModifyLocalizationBlock("THR_ADJ", country_adj_block_two);
1✔
756
   commonItems::LocalizationBlock state_block_one("REGION_ONE", "english");
1✔
757
   state_block_one.ModifyLocalization("english", "test");
1✔
758
   state_block_one.ModifyLocalization("spanish", "prueba");
1✔
759
   vic3_localizations.AddOrModifyLocalizationBlock("REGION_ONE", state_block_one);
1✔
760
   commonItems::LocalizationBlock state_block_two("REGION_TWO", "english");
1✔
761
   state_block_two.ModifyLocalization("english", "test two");
1✔
762
   state_block_two.ModifyLocalization("spanish", "prueba dos");
1✔
763
   vic3_localizations.AddOrModifyLocalizationBlock("REGION_TWO", state_block_two);
1✔
764
   commonItems::LocalizationBlock victory_point_block_one("HUB_NAME_REGION_ONE_city", "english");
1✔
765
   victory_point_block_one.ModifyLocalization("english", "test");
1✔
766
   victory_point_block_one.ModifyLocalization("spanish", "prueba");
1✔
767
   vic3_localizations.AddOrModifyLocalizationBlock("HUB_NAME_REGION_ONE_city", victory_point_block_one);
1✔
768
   commonItems::LocalizationBlock victory_point_block_two("HUB_NAME_REGION_TWO_mine", "english");
1✔
769
   victory_point_block_two.ModifyLocalization("english", "test two");
1✔
770
   victory_point_block_two.ModifyLocalization("spanish", "prueba dos");
1✔
771
   vic3_localizations.AddOrModifyLocalizationBlock("HUB_NAME_REGION_TWO_mine", victory_point_block_two);
1✔
772

773
   vic3::ProvinceDefinitions province_definitions({"x000001", "x000002", "x000003", "x000004", "x000005", "x000006"});
7✔
774

775
   const vic3::World source_world({
776
       .countries = source_countries,
777
       .states = source_states,
778
       .state_regions = source_state_regions,
779
       .province_definitions = province_definitions,
780
       .localizations = vic3_localizations,
781
   });
1✔
782

783
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
1✔
784
                                                 .AddCountries({{1, "TAG"}, {3, "THR"}})
4✔
785
                                                 .AddProvinces({
20✔
786
                                                     {"x000001", {10}},
×
787
                                                     {"x000002", {20}},
×
788
                                                     {"x000003", {30}},
×
789
                                                     {"x000004", {40}},
×
790
                                                     {"x000005", {50}},
×
791
                                                     {"x000006", {60}},
×
792
                                                 })
793
                                                 .DefaultCultureGraphicsMapper()
1✔
794
                                                 .Build();
1✔
795

796
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world", {}),
2✔
797
       source_world,
798
       world_mapper,
799
       std::async<>(std::launch::async, []() {
3✔
800
          return hoi4::WorldFrameworkBuilder::CreateDefaultWorldFramework(
2✔
801
              commonItems::ModFilesystem("test_files/hoi4_world", {}))
2✔
802
              .Build();
2✔
803
       }));
1✔
804

805
   const std::optional<commonItems::LocalizationBlock> hoi_country_localization_block =
806
       world.GetLocalizations().GetCountryLocalizations().GetLocalizationBlock("TAG");
1✔
807
   EXPECT_THAT(hoi_country_localization_block.value_or(commonItems::LocalizationBlock("", "")).GetLocalizations(),
1✔
808
       testing::UnorderedElementsAre(testing::Pair("english", "test"), testing::Pair("spanish", "prueba")));
1✔
809

810
   const std::optional<commonItems::LocalizationBlock> hoi_country_localization_block_two =
811
       world.GetLocalizations().GetCountryLocalizations().GetLocalizationBlock("THR");
2✔
812
   EXPECT_THAT(hoi_country_localization_block_two.value_or(commonItems::LocalizationBlock("", "")).GetLocalizations(),
1✔
813
       testing::UnorderedElementsAre(testing::Pair("english", "test three"), testing::Pair("spanish", "prueba tres")));
1✔
814

815
   const std::optional<commonItems::LocalizationBlock> hoi_state_localization_block =
816
       world.GetLocalizations().GetStateLocalizations().GetLocalizationBlock("STATE_1");
2✔
817
   EXPECT_THAT(hoi_state_localization_block.value_or(commonItems::LocalizationBlock("", "")).GetLocalizations(),
1✔
818
       testing::UnorderedElementsAre(testing::Pair("english", "test"), testing::Pair("spanish", "prueba")));
1✔
819

820
   const std::optional<commonItems::LocalizationBlock> hoi_state_localization_block_two =
821
       world.GetLocalizations().GetStateLocalizations().GetLocalizationBlock("STATE_2");
2✔
822
   EXPECT_THAT(hoi_state_localization_block_two.value_or(commonItems::LocalizationBlock("", "")).GetLocalizations(),
1✔
823
       testing::UnorderedElementsAre(testing::Pair("english", "test two"), testing::Pair("spanish", "prueba dos")));
1✔
824

825
   const std::optional<commonItems::LocalizationBlock> hoi_victory_point_localization_block =
826
       world.GetLocalizations().GetVictoryPointLocalizations().GetLocalizationBlock("VICTORY_POINTS_10");
2✔
827
   EXPECT_THAT(hoi_victory_point_localization_block.value_or(commonItems::LocalizationBlock("", "")).GetLocalizations(),
1✔
828
       testing::UnorderedElementsAre(testing::Pair("english", "test"), testing::Pair("spanish", "prueba")));
1✔
829

830
   const std::optional<commonItems::LocalizationBlock> hoi_victory_point_localization_block_two =
831
       world.GetLocalizations().GetVictoryPointLocalizations().GetLocalizationBlock("VICTORY_POINTS_40");
2✔
832
   EXPECT_THAT(
1✔
833
       hoi_victory_point_localization_block_two.value_or(commonItems::LocalizationBlock("", "")).GetLocalizations(),
834
       testing::UnorderedElementsAre(testing::Pair("english", "test two"), testing::Pair("spanish", "prueba dos")));
1✔
835
}
31✔
836

837

838
TEST(Hoi4worldWorldHoi4worldconverter, CharactersAreConverted)
4✔
839
{
840
   const vic3::Country source_country_one({
841
       .number = 1,
842
       .tag = "TAG",
843
       .color = commonItems::Color{std::array{1, 2, 3}},
844
       .head_of_state_id = 1,
845
       .character_ids = {1, 4, 5, 6},
846
   });
2✔
847
   const vic3::Country source_country_two({
848
       .number = 3,
849
       .tag = "TWO",
850
       .color = commonItems::Color{std::array{2, 4, 6}},
851
       .head_of_state_id = 3,
852
       .character_ids = {2, 3},
853
   });
1✔
854

855
   // Compiler was being weird about it directly in map
856
   vic3::Character character_one({.id = 1, .culture = "culture_2"});
1✔
857
   vic3::Character character_two({.id = 2, .culture = "culture_2", .roles = {"agitator"}, .origin_country_id = 1});
2✔
858
   vic3::Character character_three({.id = 3, .culture = "culture_2"});
1✔
859
   vic3::Character character_four({.id = 4, .culture = "culture_1", .roles = {"general"}});
2✔
860
   vic3::Character character_five({.id = 5, .culture = "culture_2", .roles = {"admiral"}});
2✔
861
   vic3::Character character_six({.id = 6, .culture = "culture_2", .roles = {"politician"}});
2✔
862
   const vic3::World source_world({
863
       .countries = {{1, source_country_one}, {3, source_country_two}},
×
864
       .states = {},
865
       .acquired_technologies =
866
           {
867
               {1, {"source_tech"}},
×
868
               {3, {"source_tech_two", "source_tech_three"}},
×
869
           },
870
       .culture_definitions =
871
           {
872
               {"culture_1", vic3::CultureDefinition{"culture_1", {}, {}, {}}},
3✔
873
               {"culture_2", vic3::CultureDefinition{"culture_2", {}, {}, {}}},
3✔
874
           },
875
       .characters =
876
           {
877
               {1, character_one},
×
878
               {2, character_two},
×
879
               {3, character_three},
×
880
               {4, character_four},
×
881
               {5, character_five},
×
882
               {6, character_six},
×
883
           },
884
   });
16✔
885
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
886
                                                 .AddCountries({{1, "TAG"}, {3, "TWO"}})
4✔
887
                                                 .DefaultCultureGraphicsMapper()
1✔
888
                                                 .Build();
1✔
889

890
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world", {}),
2✔
891
       source_world,
892
       world_mapper,
893
       std::async<>(std::launch::async, []() {
3✔
894
          return hoi4::WorldFrameworkBuilder::CreateNullWorldFramework().Build();
2✔
895
       }));
1✔
896

897
   const auto expected_data_leader = std::optional<Leader>({.sub_ideology = "despotism"});
2✔
898
   const auto expected_data_spy = std::optional<Spy>({.nationalities = {"TAG", "TWO"}});
3✔
899
   const auto expected_data_general = std::optional<General>({.traits = {}});
1✔
900
   const auto expected_data_admiral = std::optional<Admiral>({.traits = {}});
1✔
901
   const auto expected_data_advisor = std::optional<Advisor>({.slot = "political_advisor"});
1✔
902

903

904
   EXPECT_THAT(world.GetCharacters(),
12✔
905
       testing::UnorderedElementsAre(testing::Pair(1,
906
                                         Character({
907
                                             .id = 1,
908
                                             .portrait_alias = "GFX_leader_2",
909
                                             .leader_data = expected_data_leader,
910
                                         })),
911
           testing::Pair(2,
912
               Character({
913
                   .id = 2,
914
                   .portrait_alias = "GFX_m_op_1",
915
                   .spy_data = expected_data_spy,
916
               })),
917
           testing::Pair(3,
918
               Character({
919
                   .id = 3,
920
                   .portrait_alias = "GFX_leader_1",
921
                   .leader_data = expected_data_leader,
922
               })),
923
           testing::Pair(4,
924
               Character({
925
                   .id = 4,
926
                   .portrait_alias = "GFX_general_1",
927
                   .general_data = expected_data_general,
928
               })),
929
           testing::Pair(5,
930
               Character({
931
                   .id = 5,
932
                   .portrait_alias = "GFX_admiral_1",
933
                   .admiral_data = expected_data_admiral,
934
               })),
935
           testing::Pair(6,
936
               Character({
937
                   .id = 6,
938
                   .portrait_alias = "GFX_minister_1",
939
                   .advisor_data = expected_data_advisor,
940
               }))));
1✔
941
}
54✔
942

943

944
TEST(Hoi4worldWorldHoi4worldconverter, WarsAreConverted)
4✔
945
{
946
   const vic3::Country source_country_one({
947
       .number = 1,
948
       .tag = "TAG",
949
       .color = commonItems::Color{std::array{1, 2, 3}},
950
       .head_of_state_id = 1,
951
       .character_ids = {1, 4, 5, 6},
952
   });
2✔
953
   const vic3::Country source_country_two({
954
       .number = 3,
955
       .tag = "TWO",
956
       .color = commonItems::Color{std::array{2, 4, 6}},
957
       .head_of_state_id = 3,
958
       .character_ids = {2, 3},
959
   });
1✔
960

961
   const vic3::World source_world({
962
       .countries = {{1, source_country_one}, {3, source_country_two}},
×
963
       .states = {},
964
       .wars = {vic3::War({.original_attacker = 1, .original_defender = 3})},
965
   });
4✔
966
   const mappers::WorldMapper world_mapper = mappers::WorldMapperBuilder::CreateNullMapper()
×
967
                                                 .AddCountries({{1, "TAG"}, {3, "TWO"}})
4✔
968
                                                 .DefaultCultureGraphicsMapper()
1✔
969
                                                 .Build();
1✔
970

971
   const World world = ConvertWorld(commonItems::ModFilesystem("test_files/hoi4_world", {}),
2✔
972
       source_world,
973
       world_mapper,
974
       std::async<>(std::launch::async, []() {
3✔
975
          return hoi4::WorldFrameworkBuilder::CreateNullWorldFramework().Build();
2✔
976
       }));
1✔
977

978
   EXPECT_THAT(world.GetCountries().find("TAG")->second.GetWars(),
3✔
979
       testing::ElementsAre(War({.original_defender = "TWO", .original_attacker = "TAG"})));
1✔
980
}
10✔
981

982
}  // namespace hoi4
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

© 2025 Coveralls, Inc