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

ParadoxGameConverters / CK3toEU5 / 29985798984

23 Jul 2026 06:40AM UTC coverage: 97.913% (-2.1%) from 100.0%
29985798984

Pull #21

github

web-flow
Merge eb64591b6 into 0b521d221
Pull Request #21: Output

269 of 280 new or added lines in 16 files covered. (96.07%)

516 of 527 relevant lines covered (97.91%)

4.79 hits per line

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

98.55
/src/output/out_file_classes/output_folder_tests.cpp
1
#include <external/commonItems/external/googletest/googletest/include/gtest/gtest.h>
2
#include <gmock/gmock.h>
3

4
#include <filesystem>
5
#include <string>
6
#include <utility>
7

8
#include "output_file.hpp"
9
#include "output_folder.hpp"
10
#include "src/output/utils/folder_manager.hpp"
11

12

13
namespace out
14
{
15

16
namespace
17

18
{
19
class MockFolderManager: public FolderManager
20
{
21
  public:
NEW
22
   MOCK_METHOD(void,  // NOLINT : clang-tidy doens't like gtest
×
23
       RemoveFolder,
24
       (const std::filesystem::path& /*unused*/),
25
       (override));
26

27
   MOCK_METHOD(void,  // NOLINT : clang-tidy doens't like gtest
10✔
28
       CreateFolder,
29
       (const std::filesystem::path& /*unused*/),
30
       (override));
31
};
32

33
class MockOutputFile: public OutputFileOrResource
34
{
35
  public:
36
   explicit MockOutputFile(std::string name): OutputFileOrResource(std::move(name)) {};
6✔
37

38
   MOCK_METHOD(void,  // NOLINT : clang-tidy doens't like gtest
12✔
39
       Create,
40
       (const std::filesystem::path& /*path*/),
41
       (override));
42
};
43

44
TEST(OutputFolderTest, RegisteredSingleFileCreateCalled)  // NOLINT : clang-tidy doens't like gtest
4✔
45
{
46
   const std::string folder_name = "test_folder";
1✔
47
   const std::filesystem::path test_path = "test_path";
1✔
48

49
   MockFolderManager mock_folder_manager;
1✔
50
   OutputFolder output_folder(folder_name, &mock_folder_manager);
1✔
51

52
   const std::string file_name = "test";
1✔
53
   auto* single_file = new MockOutputFile(file_name);
1✔
54

55
   output_folder.RegisterFileOrResource(single_file);
1✔
56

57
   EXPECT_CALL(*single_file, Create(test_path / folder_name));
1✔
58

59
   output_folder.CreateRecursive(test_path);
1✔
60
}
1✔
61

62
TEST(OutputFolderTest, RegisteredMultipleFilesCreateCalled)  // NOLINT : clang-tidy doens't like gtest
4✔
63
{
64
   const std::string folder_name = "test_folder";
1✔
65
   const std::filesystem::path test_path = "test_path";
1✔
66

67
   MockFolderManager mock_folder_manager;
1✔
68
   OutputFolder output_folder(folder_name, &mock_folder_manager);
1✔
69

70
   const std::string file_name = "test";
1✔
71
   auto* single_file_0 = new MockOutputFile(file_name);
1✔
72
   auto* single_file_1 = new MockOutputFile(file_name);
1✔
73
   auto* single_file_2 = new MockOutputFile(file_name);
1✔
74
   auto* single_file_3 = new MockOutputFile(file_name);
1✔
75

76
   output_folder.RegisterFileOrResource(single_file_0);
1✔
77
   output_folder.RegisterFileOrResource(single_file_1);
1✔
78
   output_folder.RegisterFileOrResource(single_file_2);
1✔
79
   output_folder.RegisterFileOrResource(single_file_3);
1✔
80

81
   EXPECT_CALL(*single_file_0, Create(test_path / folder_name));
1✔
82
   EXPECT_CALL(*single_file_1, Create(test_path / folder_name));
1✔
83
   EXPECT_CALL(*single_file_2, Create(test_path / folder_name));
1✔
84
   EXPECT_CALL(*single_file_3, Create(test_path / folder_name));
1✔
85

86
   output_folder.CreateRecursive(test_path);
1✔
87
}
1✔
88

89
TEST(OutputFolderTest, RegisteredSingleFileInSubfolderCreateCalled)  // NOLINT : clang-tidy doens't like gtest
4✔
90
{
91
   const std::string folder_name = "test_folder";
2✔
92
   const std::string subfolder_name = "test_subfolder";
1✔
93
   const std::filesystem::path test_path = "test_path";
1✔
94

95
   MockFolderManager mock_folder_manager;
1✔
96
   OutputFolder output_folder(folder_name, &mock_folder_manager);
1✔
97
   auto* subfolder = new OutputFolder(subfolder_name, &mock_folder_manager);
1✔
98

99
   const std::string file_name = "test";
1✔
100
   auto* single_file = new MockOutputFile(file_name);
1✔
101

102
   output_folder.RegisterSubfolder(subfolder);
1✔
103
   subfolder->RegisterFileOrResource(single_file);
1✔
104

105
   EXPECT_CALL(*single_file, Create(test_path / folder_name / subfolder_name));
1✔
106

107
   output_folder.CreateRecursive(test_path);
1✔
108
}
1✔
109

110
TEST(OutputFolderTest, FolderCreated)  // NOLINT : clang-tidy doens't like gtest
4✔
111
{
112
   const std::string folder_name = "test_folder";
1✔
113
   const std::filesystem::path test_path = "test_path";
1✔
114

115
   MockFolderManager mock_folder_manager;
1✔
116
   OutputFolder output_folder(folder_name, &mock_folder_manager);
1✔
117

118
   EXPECT_CALL(mock_folder_manager, CreateFolder(test_path / folder_name));
1✔
119

120
   output_folder.CreateRecursive(test_path);
1✔
121
}
1✔
122

123
TEST(OutputFolderTest, SubfolderCreated)  // NOLINT : clang-tidy doens't like gtest
4✔
124
{
125
   const std::string folder_name = "test_folder";
2✔
126
   const std::string subfolder_name = "test_subfolder";
1✔
127
   const std::filesystem::path test_path = "test_path";
1✔
128

129
   MockFolderManager mock_folder_manager;
1✔
130
   OutputFolder output_folder(folder_name, &mock_folder_manager);
1✔
131
   auto* subfolder = new OutputFolder(subfolder_name, &mock_folder_manager);
1✔
132

133
   output_folder.RegisterSubfolder(subfolder);
1✔
134

135
   EXPECT_CALL(mock_folder_manager, CreateFolder(test_path / folder_name));
1✔
136
   EXPECT_CALL(mock_folder_manager, CreateFolder(test_path / folder_name / subfolder_name));
1✔
137

138
   output_folder.CreateRecursive(test_path);
1✔
139
}
1✔
140

141

142

143
}  // namespace
144

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

© 2026 Coveralls, Inc