20 template <
typename ConfigWriterType,
typename ConfigParserType>
21 static bool TestParser(
const FDlgIOTesterOptions& Options,
const FString NameWriterType = FString(),
22 const FString NameParserType = FString());
25 static bool TestAllParsers();
27 template <
typename ConfigWriterType,
typename ConfigParserType,
typename StructType>
28 static bool TestStruct(
const FString& StructDescription,
30 const FString NameWriterType = FString(),
31 const FString NameParserType = FString());
38 bool bAllSucceeded =
true;
40 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestStructPrimitives>(
"Struct of Primitives", Options, NameWriterType, NameParserType);
41 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestStructComplex>(
"Struct of Complex types", Options, NameWriterType, NameParserType);
43 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestArrayPrimitive>(
"Array of Primitives", Options, NameWriterType, NameParserType);
44 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestArrayComplex>(
"Array of Complex types", Options, NameWriterType, NameParserType);
46 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestSetPrimitive>(
"Set of Primitives", Options, NameWriterType, NameParserType);
47 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestSetComplex>(
"Set of Complex types", Options, NameWriterType, NameParserType);
49 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestMapPrimitive>(
"Map with Primitives", Options, NameWriterType, NameParserType);
50 bAllSucceeded &= TestStruct<ConfigWriterType, ConfigParserType, FDlgTestMapComplex>(
"Map with Complex types", Options, NameWriterType, NameParserType);
59 StructType ExportedStruct;
60 StructType ImportedStruct;
61 ExportedStruct.GenerateRandomData(Options);
62 ImportedStruct.GenerateRandomData(Options);
65 ConfigWriterType Writer;
67 Writer.Write(StructType::StaticStruct(), &ExportedStruct);
68 const FString WriterString = Writer.GetAsString();
71 ConfigParserType Parser;
73 Parser.InitializeParserFromString(WriterString);
74 Parser.ReadAllProperty(StructType::StaticStruct(), &ImportedStruct);
78 if (ExportedStruct.IsEqual(ImportedStruct, ErrorMessage))
83 if (NameWriterType.IsEmpty() || NameParserType.IsEmpty())
85 UE_LOG(LogDlgIOTester,
Warning, TEXT(
"TestStruct: Test Failed (both empty) = %s"), *StructDescription);
90 ConfigWriterType DebugParser;
91 DebugParser.Write(StructType::StaticStruct(), &ImportedStruct);
92 const FString ParserString = DebugParser.GetAsString();
94 UE_LOG(LogDlgIOTester,
Warning, TEXT(
"This = ExportedStruct, Other = ImportedStruct"));
95 UE_LOG(LogDlgIOTester,
Warning, TEXT(
"Writer = %s, Parser = %s. Test Failed = %s"), *NameWriterType, *NameParserType, *StructDescription);
96 UE_LOG(LogDlgIOTester,
Warning, TEXT(
"ErrorMessage = %s"), *ErrorMessage);
97 UE_LOG(LogDlgIOTester,
Warning, TEXT(
"ExportedStruct.GetAsString() = |%s|\n"), *WriterString);
98 UE_LOG(LogDlgIOTester,
Warning, TEXT(
"ImportedStruct.GetAsString() = |%s|\n"), *ParserString);
99 UE_LOG(LogDlgIOTester,
Warning, TEXT(
""));