Reschedule undo clears the calendar replay bit (#16)
UndoReschedule of the original clears bit 0x4000 of the calendar day (high byte & 0xbf) when no replay of another club stays on it; both cores kept the bit, so the day and its neighbour were no longer offered as targets after a move was taken back. Tests check the same target days after the undo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9fc05d18ee
commit
cbde7b367e
6 files changed
+34
-6
No files matched your search
@@ -440,6 +440,15 @@ int main(int argc, char** argv) {
|
||||
check(moved_seen, "calendar: the moved match on its new date");
|
||||
const J undone = session.ui_command(cmd("request:f2", "fixture.reschedule", O{{"action", "undo"}, {"date", target}}), rev);
|
||||
check(s(at(undone, "messageType")) == "command_result", "move taken back");
|
||||
// issue 16: after the undo the match offers the same target dates as before the move
|
||||
const auto targets_of = [&](const J& read) {
|
||||
if (const auto* list = at(at(read, "data"), "movable").array())
|
||||
for (const auto& mv : *list)
|
||||
if (s(at(mv, "id")) == match) return cli::dump_json(at(mv, "targetDates"));
|
||||
return std::string{};
|
||||
};
|
||||
check(!targets_of(sched).empty() && targets_of(session.ui_read(O{{"kind", "scheduling"}}, rev)) == targets_of(sched),
|
||||
"the same target dates after the undo");
|
||||
std::printf("(moved %s to %s and back)\n", match.c_str(), target.c_str());
|
||||
}
|
||||
const J friendly = session.ui_read(O{{"kind", "friendly"}, {"opponentId", "team:70"}, {"home", true}}, rev);
|
||||
|
||||
@@ -76,6 +76,11 @@ void reschedule_test(GameState g) {
|
||||
check(undone.memory.u16(at) == 0 && undone.results.at(size_t(m.match) + size_t(m.round) * 10 + size_t(league) * 0x17c) == kNotPlayed,
|
||||
"undo frees the entry and restores 0xCC");
|
||||
check(reschedulable_matches(undone, 0).size() == matches.size(), "the match is movable again");
|
||||
// UndoReschedule clears the replay bit when no other replay stays on the day: the same
|
||||
// target days as before the move (issue 16)
|
||||
check((undone.memory.u16(::bmh::layout::CompetitionCalendar + uint32_t(target) * 2) & 0x4000) == 0,
|
||||
"undo clears the calendar replay bit");
|
||||
check(reschedule_target_days(undone, 0, m) == days, "the same target days after the undo");
|
||||
std::cout << "moved round " << m.round + 1 << " from day " << m.day << " to day " << target << " (" << days.size()
|
||||
<< " days offered)\n";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user