@@ -67,12 +67,12 @@ std::vector<warden::WardenCheckRowInput> FirstProfileRows()
6767{
6868 std::vector<warden::WardenCheckRowInput> rows =
6969 warden::test::InitialWardenRows ();
70- rows.resize (7 );
70+ rows.resize (9 );
7171 return rows;
7272}
7373}
7474
75- TEST (WardenCheckCatalog_decodes_and_selects_three_exact_profiles )
75+ TEST (WardenCheckCatalog_decodes_and_selects_eight_exact_profiles )
7676{
7777 warden::WardenCheckCatalogBuilder builder;
7878 warden::WardenCheckDiagnostic diagnostic;
@@ -86,21 +86,94 @@ TEST(WardenCheckCatalog_decodes_and_selects_three_exact_profiles)
8686 warden::WardenCheckCatalog catalog;
8787 REQUIRE (builder.Build (catalog, diagnostic) ==
8888 warden::CheckCatalogValidation::Valid);
89- CHECK_EQ (catalog.TotalRows (), uint32 (21 ));
90- CHECK_EQ (catalog.EnabledRows (), uint32 (21 ));
91- CHECK_EQ (catalog.Profiles ().size (), size_t (3 ));
89+ CHECK_EQ (catalog.TotalRows (), uint32 (72 ));
90+ CHECK_EQ (catalog.EnabledRows (), uint32 (72 ));
91+ CHECK_EQ (catalog.Profiles ().size (), size_t (8 ));
92+
93+ struct ProfileExpectation
94+ {
95+ uint32 build;
96+ char const * locale;
97+ char const * mpqSha1;
98+ char const * luaText;
99+ uint32 frameDispatchAddress;
100+ char const * frameDispatchBytes;
101+ };
102+ ProfileExpectation const profiles[] =
103+ {
104+ {5875 , " enUS" , " 7d88154d3411811985f5d81177c5453248133443" ,
105+ " 4f6b6179" , 4784584 ,
106+ " 5eff48006bff480078ff480095ff4800" },
107+ {5875 , " koKR" , " 755d6d7f49bb34114433386d559261ed3aa23f00" ,
108+ " ed9995ec9db8" , 4784584 ,
109+ " 5eff48006bff480078ff480095ff4800" },
110+ {5875 , " zhTW" , " 2a70e6402a40a4f9e9960ced419dba5e6deb8536" ,
111+ " e7a2bae5ae9a" , 4784584 ,
112+ " 5eff48006bff480078ff480095ff4800" },
113+ {5875 , " frFR" , " af2d81af013a9ba6bb92ce171e43fa903c9e8c09" ,
114+ " 4f4b" , 4784584 ,
115+ " 5eff48006bff480078ff480095ff4800" },
116+ {5875 , " esES" , " 1ecec2c6596b8411fa5fe153edfb9a6ee43360e9" ,
117+ " 41636570746172" , 4784584 ,
118+ " 5eff48006bff480078ff480095ff4800" },
119+ {6005 , " enGB" , " 7d88154d3411811985f5d81177c5453248133443" ,
120+ " 4f6b6179" , 4784584 ,
121+ " 5eff48006bff480078ff480095ff4800" },
122+ {6005 , " deDE" , " a0b3dc2d78ad892f2436bcd937be51b4989d64c1" ,
123+ " 4f4b" , 4784584 ,
124+ " 5eff48006bff480078ff480095ff4800" },
125+ {6141 , " zhCN" , " c5a1de4c1cd412eb4d2e02afab6131b737efcaf0" ,
126+ " e7a1aee5ae9a" , 4788152 ,
127+ " 4e0d49005b0d4900680d4900850d4900" }
128+ };
129+ uint32 const expectedIds[] =
130+ {65536 , 1 , 2 , 1107 , 827 , 1566 , 1135 , 65537 , 65538 };
131+
132+ for (ProfileExpectation const & expected : profiles)
133+ {
134+ warden::WardenCheckProfile const * profile =
135+ catalog.Find (expected.build , " Win" , expected.locale );
136+ REQUIRE (profile != nullptr );
137+ REQUIRE (profile->checks .size () == 9u );
138+ CHECK (profile->hasActionableChecks );
139+ CHECK_EQ (profile->totalRows , uint32 (9 ));
140+ for (size_t index = 0 ; index < 9u ; ++index)
141+ {
142+ CHECK_EQ (warden::GetWardenCheckId (profile->checks [index]),
143+ expectedIds[index]);
144+ }
145+
146+ CHECK (warden::GetWardenCheckType (profile->checks [0 ]) ==
147+ warden::WardenCheckType::Timing);
148+ CHECK (!warden::IsConfirmationEligible (profile->checks [0 ]));
149+ CHECK (warden::IsConfirmationEligible (profile->checks [1 ]));
150+
151+ warden::MpqCheckProfile const & mpq =
152+ std::get<warden::MpqCheckProfile>(profile->checks [1 ].payload );
153+ CHECK_HEX (mpq.expectedSha1 .data (), mpq.expectedSha1 .size (),
154+ expected.mpqSha1 );
155+ warden::LuaCheckProfile const & lua =
156+ std::get<warden::LuaCheckProfile>(profile->checks [2 ].payload );
157+ CHECK_HEX (reinterpret_cast <uint8 const *>(lua.expectedText .data ()),
158+ lua.expectedText .size (), expected.luaText );
159+
160+ warden::MemCheckProfile const & glue =
161+ std::get<warden::MemCheckProfile>(profile->checks [7 ].payload );
162+ CHECK_EQ (glue.addressOrRva , uint32 (4631212 ));
163+ CHECK_HEX (glue.expectedBytes .data (), glue.expectedBytes .size (),
164+ " 1ca9460029a9460036a946009ea94600" );
165+ CHECK (profile->checks [7 ].evidenceClass ==
166+ warden::WardenEvidenceClass::IntegrityInvariant);
167+
168+ warden::MemCheckProfile const & frame =
169+ std::get<warden::MemCheckProfile>(profile->checks [8 ].payload );
170+ CHECK_EQ (frame.addressOrRva , expected.frameDispatchAddress );
171+ CHECK_HEX (frame.expectedBytes .data (), frame.expectedBytes .size (),
172+ expected.frameDispatchBytes );
173+ CHECK (profile->checks [8 ].evidenceClass ==
174+ warden::WardenEvidenceClass::IntegrityInvariant);
175+ }
92176
93- warden::WardenCheckProfile const * profile =
94- catalog.Find (6141 , " Win" , " zhCN" );
95- REQUIRE (profile != nullptr );
96- REQUIRE (profile->checks .size () == 7u );
97- CHECK (profile->hasActionableChecks );
98- CHECK_EQ (profile->totalRows , uint32 (7 ));
99- CHECK_EQ (warden::GetWardenCheckId (profile->checks [0 ]), uint32 (65536 ));
100- CHECK (warden::GetWardenCheckType (profile->checks [0 ]) ==
101- warden::WardenCheckType::Timing);
102- CHECK (!warden::IsConfirmationEligible (profile->checks [0 ]));
103- CHECK (warden::IsConfirmationEligible (profile->checks [1 ]));
104177 CHECK (warden::IsActionableEvidenceClass (
105178 warden::WardenEvidenceClass::IntegrityInvariant));
106179 CHECK (warden::IsActionableEvidenceClass (
@@ -110,12 +183,7 @@ TEST(WardenCheckCatalog_decodes_and_selects_three_exact_profiles)
110183 CHECK (!warden::IsActionableEvidenceClass (
111184 warden::WardenEvidenceClass::Corroboration));
112185
113- warden::LuaCheckProfile const & lua =
114- std::get<warden::LuaCheckProfile>(profile->checks [2 ].payload );
115- CHECK_HEX (reinterpret_cast <uint8 const *>(lua.expectedText .data ()),
116- lua.expectedText .size (), " e7a1aee5ae9a" );
117- CHECK (catalog.Find (5875 , " Win" , " enUS" ) != nullptr );
118- CHECK (catalog.Find (6005 , " Win" , " enGB" ) != nullptr );
186+ CHECK (catalog.Find (5875 , " Win" , " itIT" ) == nullptr );
119187 CHECK (catalog.Find (6005 , " Win" , " enUS" ) == nullptr );
120188 CHECK (catalog.Find (6141 , " OSX" , " zhCN" ) == nullptr );
121189}
@@ -239,7 +307,7 @@ TEST(WardenCheckCatalog_enforces_timing_contract_and_cardinality)
239307 CHECK (BuildRows (rows) == warden::CheckCatalogValidation::DisabledTiming);
240308 rows = FirstProfileRows ();
241309 warden::WardenCheckRowInput secondTiming = rows[0 ];
242- secondTiming.checkId = 65537 ;
310+ secondTiming.checkId = 65539 ;
243311 secondTiming.sortOrder = 11 ;
244312 rows.push_back (secondTiming);
245313 CHECK (BuildRows (rows) == warden::CheckCatalogValidation::MultipleTiming);
@@ -523,12 +591,12 @@ TEST(WardenCheckCatalog_enforces_complete_profiles_and_atomic_build)
523591
524592 warden::WardenCheckCatalog unchanged =
525593 warden::test::BuildInitialWardenCatalog ();
526- REQUIRE (unchanged.TotalRows () == 21u );
594+ REQUIRE (unchanged.TotalRows () == 72u );
527595 rows = FirstProfileRows ();
528596 rows[2 ].checkId = rows[1 ].checkId ;
529597 CHECK (BuildRows (rows, unchanged) ==
530598 warden::CheckCatalogValidation::DuplicateId);
531- CHECK_EQ (unchanged.TotalRows (), uint32 (21 ));
599+ CHECK_EQ (unchanged.TotalRows (), uint32 (72 ));
532600 CHECK (unchanged.Find (6141 , " Win" , " zhCN" ) != nullptr );
533601}
534602
0 commit comments