Bind league fixtures and round navigation to live engine data (by Codex)
This commit is contained in:
1 parent
1c35698dbe
commit
545e16f153
21 files changed
+207
-31
No files matched your search
@@ -47,6 +47,18 @@ int main() try {
|
||||
for(const auto &r:*at(at(second,"data"),"table").array()){check(integer(at(r,"played"))==0,"unplayed second half has no invented matches");ranks.push_back(integer(at(r,"rank")));}
|
||||
std::sort(ranks.begin(),ranks.end());for(size_t i=0;i<ranks.size();++i)check(ranks[i]==int(i+1),"unplayed half has unique engine ranks");
|
||||
for(const auto &r:*at(at(all,"data"),"strengths").array())check(std::holds_alternative<std::nullptr_t>(at(r,"strength").value),"absent squads do not receive fake strength");
|
||||
const auto fixtures=[&](int round){return modern::ui_read(g,context,O{{"kind","league-fixtures"},{"leagueId","league:0"},{"round",round}});};
|
||||
const auto played_fixture=fixtures(1);const auto& first_fixture=at(at(played_fixture,"data"),"matches").array()->at(0);
|
||||
check(*at(first_fixture,"status").string()=="played" && integer(at(first_fixture,"result").array()->at(0))==2,"played fixture keeps its actual score");
|
||||
for(const auto marker:{0xcc,0xcd,0xce,0xde,0xee,0xcf}) {
|
||||
g.results[0]=uint8_t(marker);const auto r=fixtures(1);const auto& m=at(at(r,"data"),"matches").array()->at(0);
|
||||
const std::string expected=(marker&0xcf)==0xcc?"open":(marker&0xcf)==0xcd?"postponed":(marker&0xcf)==0xce?"rescheduled":"unavailable";
|
||||
check(*at(m,"status").string()==expected && std::holds_alternative<std::nullptr_t>(at(m,"result").value),"unplayed markers cannot become 12:14 scores");
|
||||
}
|
||||
g.results[0]=0x21;
|
||||
const auto next=modern::ui_read(g,context,O{{"kind","league-fixtures"},{"leagueId","league:0"}});
|
||||
check(integer(at(at(next,"data"),"round"))==3,"default round is the engine's next matchday");
|
||||
check(*at(fixtures(0),"messageType").string()=="error"&&*at(fixtures(35),"messageType").string()=="error","round boundaries enforced");
|
||||
const auto invalid=read(5);check(*at(invalid,"messageType").string()=="error","invalid filter rejected");
|
||||
const auto foreign=modern::ui_read(g,context,O{{"kind","report-index"},{"managerId","manager:not-active"}});check(*at(foreign,"code").string()=="manager_not_active","foreign manager rejected");
|
||||
std::cout<<"report subsets, empty halves, engine parity and scope passed\n";return 0;
|
||||
|
||||
Reference in new issue
Block a user