Files
gogobee/internal/plugin/zone_graph_dragons_lair_test.go
prosolis 42fb805ee0 Long expeditions D1-e: T5 zones to new 36-44 room band
Closes D1. Both T5 zones follow the D1-a/b/c/d pattern: extend the
graph so the longest entry→boss walk lands in band, keep the zone's
authored topology intact. Also backfills the missing per-node
RegionID authoring against dnd_expedition_region.go — the D1-d
deferral note flagged this as a prerequisite for T5.

  dragons_lair (T5): 12 → 47 nodes, longest 38 (band 36-44)
  abyss_portal (T5): 13 → 51 nodes, longest 39 (band 36-44)

Topology preserved per zone:
- Dragon's Lair: 4-region authoring (every node carries a valid
  RegionID); binary-converging fork1 (ash_bridge TRAP / treasure_vault
  Perception 15) still converges at the R3 wyrmlings_nest elite;
  capstone fork2 still 3-way (LockNone / CHA 16 / Perception 17
  SECRET LootBias 2.5) with each spur preserving its own named
  capstone node. New R4 infernax_doors MERGE consolidates the long
  final hall instead of triplicating it.
- Abyss Portal: 4-region authoring; three sequential forks preserved
  (binary / binary / ternary) — fork1 Perception 16, fork2 CON 16
  (full STR/DEX/CON/INT/WIS/CHA roster still covered), fork3 capstone
  3-way with reality_seam SECRET LootBias 3.0. New R4 belaxath_doors
  MERGE consolidates the final tear-approach.

MinRooms/MaxRooms re-pitched 9-10 → 36-44 so the dice fallback also
lands in band for any future graphless variant.
2026-05-27 18:13:33 -07:00

114 lines
3.6 KiB
Go

package plugin
import "testing"
func TestDragonsLairGraph_Registered(t *testing.T) {
g, ok := zoneGraphRegistry[ZoneDragonsLair]
if !ok {
t.Fatal("zoneDragonsLairGraph not registered")
}
// Long-expedition D1-e widened this zone from 12 → 47 nodes so the
// longest entry→boss walk lands in the T5 [36,44] traversal band.
if len(g.Nodes) != 47 {
t.Errorf("nodes = %d, want 47", len(g.Nodes))
}
}
func TestDragonsLairGraph_LongestPathInBand(t *testing.T) {
g := zoneDragonsLairGraph()
got := graphLongestPath(g)
if got < 36 || got > 44 {
t.Errorf("longest path = %d, want in T5 band [36,44]", got)
}
}
// TestDragonsLairGraph_AllNodesHaveRegion confirms D1-e backfilled the
// missing RegionID authoring per dnd_expedition_region.go: every node
// carries a non-empty RegionID matching the registry.
func TestDragonsLairGraph_AllNodesHaveRegion(t *testing.T) {
g := zoneDragonsLairGraph()
validRegions := map[string]bool{
"dragons_lair_kobold_warrens": true,
"dragons_lair_drake_pens": true,
"dragons_lair_the_vault": true,
"dragons_lair_infernax_chamber": true,
}
for id, n := range g.Nodes {
if n.RegionID == "" {
t.Errorf("node %s has empty RegionID — D1-e requires region authoring on every node", id)
}
if !validRegions[n.RegionID] {
t.Errorf("node %s RegionID = %q, not in dnd_expedition_region.go registry", id, n.RegionID)
}
}
}
// TestDragonsLairGraph_AllFourRegionsRepresented confirms each authored
// region has at least one node.
func TestDragonsLairGraph_AllFourRegionsRepresented(t *testing.T) {
g := zoneDragonsLairGraph()
regions := map[string]int{}
for _, n := range g.Nodes {
regions[n.RegionID]++
}
for _, r := range []string{
"dragons_lair_kobold_warrens",
"dragons_lair_drake_pens",
"dragons_lair_the_vault",
"dragons_lair_infernax_chamber",
} {
if regions[r] == 0 {
t.Errorf("region %q has no nodes — multi-region invariant broken", r)
}
}
}
// TestDragonsLairGraph_Fork1Converges verifies the binary mid-fork's
// two spurs both converge at wyrmlings_nest (R3 boundary).
func TestDragonsLairGraph_Fork1Converges(t *testing.T) {
g := zoneDragonsLairGraph()
for _, spurTail := range []string{"dragons_lair.cinder_walk", "dragons_lair.vault_passage"} {
outs := g.outgoingEdges(spurTail)
if len(outs) != 1 || outs[0].To != "dragons_lair.wyrmlings_nest" {
t.Errorf("%s outs = %+v, want single edge to wyrmlings_nest", spurTail, outs)
}
}
}
// TestDragonsLairGraph_Fork2Capstone verifies the late fork has 3
// distinct paths to the boss, each through its own capstone node.
func TestDragonsLairGraph_Fork2Capstone(t *testing.T) {
g := zoneDragonsLairGraph()
outs := g.outgoingEdges("dragons_lair.fork2")
if len(outs) != 3 {
t.Fatalf("fork2 outgoing = %d, want 3", len(outs))
}
for _, leaf := range []string{
"dragons_lair.direct_confrontation",
"dragons_lair.dragon_bargain",
"dragons_lair.hoard_pillar",
} {
if !reachable(g, leaf, "dragons_lair.boss") {
t.Errorf("%s unreachable to boss", leaf)
}
}
// Locks escalate: open / CHA 16 / Perception 17 (T5 secret bias).
for _, e := range outs {
if e.To == "dragons_lair.hidden_passage" {
if dc := lockDataInt(e.LockData, "dc", 0); dc < 17 {
t.Errorf("hoard_pillar spur DC = %d, want >= 17 (T5)", dc)
}
}
}
}
// TestDragonsLairGraph_LootBiasEscalation verifies the T5 secret has
// the highest loot bias of any authored zone (≥ 2.5).
func TestDragonsLairGraph_LootBiasEscalation(t *testing.T) {
g := zoneDragonsLairGraph()
hoard := g.Nodes["dragons_lair.hoard_pillar"]
if hoard.Content.LootBias < 2.5 {
t.Errorf("hoard_pillar LootBias = %v, want >= 2.5 (T5 secret)", hoard.Content.LootBias)
}
}