Fix C++ test printers

It turns out that they were never used, I noticed this while debugging some LOOT tests, which have a copy of the same printers.h file.
This commit is contained in:
Oliver Hamlet
2026-04-22 18:05:27 +01:00
parent 56bafaead3
commit 391b9ad7c9
2 changed files with 26 additions and 15 deletions
+1
View File
@@ -40,6 +40,7 @@
#include "tests/api/interface/metadata/plugin_metadata_test.h"
#include "tests/api/interface/metadata/tag_test.h"
#include "tests/api/interface/plugin_interface_test.h"
#include "tests/printers.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
+25 -15
View File
@@ -29,21 +29,30 @@ along with LOOT. If not, see
#include <iostream>
#include "api/metadata/message_content.h"
#include "api/plugin.h"
#include "loot/metadata/file.h"
#include "loot/metadata/group.h"
#include "loot/metadata/location.h"
#include "loot/metadata/message.h"
#include "loot/metadata/plugin_cleaning_data.h"
#include "loot/metadata/plugin_metadata.h"
#include "loot/metadata/tag.h"
#include "loot/plugin_interface.h"
namespace loot {
namespace test {
void PrintTo(const File& value, ::std::ostream* os) {
*os << "File(\"" << std::string(value.GetName()) << "\", "
<< "\"" << value.GetDisplayName() << "\", "
<< "\"" << value.GetCondition() << "\""
<< "\"" << value.GetCondition() << "\", "
<< ::testing::PrintToString(value.GetDetail()) << ", "
<< "\"" << value.GetConstraint() << "\""
<< ")";
}
void PrintTo(const Group& value, ::std::ostream* os) {
*os << "Group(\"" << value.GetName() << "\", "
<< ::testing::PrintToString(value.GetAfterGroups()) << ", "
<< "\"" << value.GetDescription() << "\""
<< ")";
}
@@ -56,13 +65,13 @@ void PrintTo(const Location& value, ::std::ostream* os) {
void PrintTo(const Message& value, ::std::ostream* os) {
std::string type;
if (value.GetType() == MessageType::warn)
type = "warn";
type = "MessageType::warn";
else if (value.GetType() == MessageType::error)
type = "error";
type = "MessageType::error";
else
type = "say";
type = "MessageType::say";
*os << "Message(\"" << type << "\", "
*os << "Message(" << type << ", "
<< ::testing::PrintToString(value.GetContent()) << ", "
<< "\"" << value.GetCondition() << "\""
<< ")";
@@ -70,16 +79,18 @@ void PrintTo(const Message& value, ::std::ostream* os) {
void PrintTo(const MessageContent& value, ::std::ostream* os) {
*os << "MessageContent(\"" << value.GetText() << "\", "
<< "\"" << Language(value.GetLanguage()).GetName() << "\""
<< "\"" << value.GetLanguage() << "\""
<< ")";
}
void PrintTo(const PluginCleaningData& value, ::std::ostream* os) {
*os << "PluginCleaningData(0x" << std::hex << std::uppercase << value.GetCRC()
<< std::nouppercase << std::dec << ", " << value.GetITMCount() << ", "
<< value.GetDeletedReferenceCount() << ", "
<< std::nouppercase << std::dec << ", "
<< "\"" << value.GetCleaningUtility() << "\", "
<< ::testing::PrintToString(value.GetDetail()) << ", "
<< value.GetITMCount() << ", " << value.GetDeletedReferenceCount() << ", "
<< value.GetDeletedNavmeshCount() << ", "
<< "\"" << value.GetCleaningUtility() << "\""
<< "\"" << value.GetCondition() << "\""
<< ")";
}
@@ -93,9 +104,8 @@ void PrintTo(const Tag& value, ::std::ostream* os) {
<< ")";
}
void PrintTo(const Plugin& value, ::std::ostream* os) {
*os << "Plugin(\"" << value.GetName() << "\")";
}
void PrintTo(const PluginInterface& value, ::std::ostream* os) {
*os << "PluginInterface(\"" << value.GetName() << "\")";
}
}