fix(battlenode): PlayedCardTribe degrades to 0 not empty; clan/tribe builder tests (M-HC-4e review)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-07 00:23:07 -04:00
parent 693fba5003
commit d3508d7bd4
3 changed files with 38 additions and 6 deletions

View File

@@ -125,6 +125,33 @@ public class KnownListBuilderTests
Assert.That(KnownListBuilder.BuildPlayedCard(deckMap, 3, OrderListMove(3, 10, 20))!.Spellboost, Is.EqualTo(0));
}
[Test]
public void BuildPlayedCard_emits_clan_tribe_passed_by_caller()
{
// M-HC-4e: the handler reads the engine-resolved clan/tribe
// (SessionBattleEngine.PlayedCardClan / PlayedCardTribe) and passes them in; BuildPlayedCard lands
// them on the entry verbatim. (A wrong clan/tribe yields a different field — non-vacuity.)
var deckMap = new Dictionary<int, long> { [3] = 101314020L };
var entry = KnownListBuilder.BuildPlayedCard(
deckMap, playIdx: 3, orderList: OrderListMove(3, 10, 20), cost: 3, spellboost: 2, clan: 8, tribe: "7,16");
Assert.That(entry, Is.Not.Null);
Assert.That(entry!.Clan, Is.EqualTo(8));
Assert.That(entry.Tribe, Is.EqualTo("7,16"));
}
[Test]
public void BuildPlayedCard_defaults_clan_to_zero_and_tribe_to_string_zero_when_caller_passes_none()
{
// A play whose engine read degraded (single-active-engine gate: _mgr null → the accessor fallback)
// emits clan 0 (ClanType.ALL ordinal) and tribe "0" (the prod no-tribe form, NEVER empty —
// empty is wire-illegal). The param defaults match the accessor fallbacks.
var deckMap = new Dictionary<int, long> { [3] = 101311010L };
var entry = KnownListBuilder.BuildPlayedCard(deckMap, 3, OrderListMove(3, 10, 20));
Assert.That(entry, Is.Not.Null);
Assert.That(entry!.Clan, Is.EqualTo(0));
Assert.That(entry.Tribe, Is.EqualTo("0"));
}
[Test]
public void RenameTargets_passes_isSelf_through_verbatim()
{