refactor(battle-node): address final-review minor notes (comments + test backfill)
- PlayActionsHandler doc: drop the phantom 'with a debug log' (handlers are stateless singletons with no logger); say token plays degrade silently. - KnownListBuilder.ExtractMoveTo doc: note first-match-wins semantics and the send-side==recv-side 'to' assumption pending recv-capture confirmation. - KnownListBuilderTests: add multi-move first-match coverage and the in-deck-but-no-matching-move null branch for BuildPlayedCard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,41 @@ public class KnownListBuilderTests
|
||||
Assert.That(KnownListBuilder.ExtractMoveTo(null, playIdx: 3), Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ExtractMoveTo_returns_first_matching_move_op()
|
||||
{
|
||||
// A real PlayActions can carry several move ops; the played card's move comes first,
|
||||
// later ops (token add/alter) target other idxs. Confirm first-match-wins, not last.
|
||||
var orderList = new List<object?>
|
||||
{
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
["move"] = new Dictionary<string, object?>
|
||||
{
|
||||
["idx"] = new List<object?> { 3L }, ["isSelf"] = 1L, ["from"] = 10L, ["to"] = 30L,
|
||||
}
|
||||
},
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
["move"] = new Dictionary<string, object?>
|
||||
{
|
||||
["idx"] = new List<object?> { 31L, 32L }, ["isSelf"] = 1L, ["from"] = 0L, ["to"] = 40L,
|
||||
}
|
||||
},
|
||||
};
|
||||
Assert.That(KnownListBuilder.ExtractMoveTo(orderList, playIdx: 3), Is.EqualTo(30));
|
||||
Assert.That(KnownListBuilder.ExtractMoveTo(orderList, playIdx: 31), Is.EqualTo(40));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildPlayedCard_returns_null_for_deck_card_with_no_matching_move_op()
|
||||
{
|
||||
// idx is in the deck, but the orderList has no move op for it → can't synthesize.
|
||||
var deckMap = new Dictionary<int, long> { [3] = 128821011L };
|
||||
var entry = KnownListBuilder.BuildPlayedCard(deckMap, playIdx: 3, orderList: OrderListMove(7, 10, 20));
|
||||
Assert.That(entry, Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BuildPlayedCard_synthesizes_entry_for_deck_card()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user