Enhance:ini registry sequence (#121)

* '+=' supported .
* introduced registry list value deduplication .
* TechnoType listing now parse data both from ini and map .
* added UT case .
This commit is contained in:
Zero Fanker 2024-12-01 14:09:30 -05:00 committed by GitHub
parent 3e90dca667
commit 93e956e7ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 164 additions and 50 deletions

View file

@ -275,4 +275,34 @@ TEST(CIniFileClass, IniLowerBoundInsertTest) {
EXPECT_EQ(987654, file.GetInteger("Waypoints", "11"));
EXPECT_EQ("987654", file["Waypoints"].Nth(pSec->Size() - 1).second);
EXPECT_EQ("159356", file["Waypoints"].Nth(pSec->Size() - 2).second);
}
TEST(CIniFileClass, IniRegistryTest) {
auto const fileName = "test.ini";
IniTestHelper helper(fileName, R"(
[BuildingTypes]
0=GAPOWR
1=NAPOWR
2=GACNST
5=NACNST
6=GAPOWR
6=NAFAKE
)");
CIniFile file;
ASSERT_EQ(file.LoadFile(std::string(fileName)), 0);
EXPECT_EQ("NAFAKE", file.GetString("BuildingTypes", "6"));
auto const& sec = file.GetSection("BuildingTypes");
EXPECT_EQ(5, sec.Size());
EXPECT_EQ("GAPOWR", sec.Nth(0).second);
EXPECT_EQ("NAPOWR", sec.Nth(1).second);
EXPECT_EQ("GACNST", sec.Nth(2).second);
EXPECT_EQ("NACNST", sec.Nth(3).second);
EXPECT_EQ("NAFAKE", sec.Nth(4).second);
}