Files
gogobee/internal/plugin/zone_graph_sunken_temple_test.go
prosolis 675d70e85b Branching zones G8c: Sunken Temple sequential forks (no mid-path merge)
T2 zone, third authored graph. Shape: two-tier sequential forks where
each path is unique up to the boss room. Four committed leaves
(kuo_toa_pen / glyph_chamber / aboleth_thralls / coral_reliquary) all
terminate at the boss; no mid-path node has >1 incoming edge.

Differentiates from Crypt's diamond and Forest's asymmetric-diamond by
producing two parallel "Y" subtrees on the !zone map instead of a
converging branch. Exercises Perception + StatCheck (STR) + LockNone
in a single zone (covered by TestSunkenTempleGraph_LockKindCoverage).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 16:52:52 -07:00

81 lines
2.3 KiB
Go

package plugin
import "testing"
func TestSunkenTempleGraph_Registered(t *testing.T) {
g, ok := zoneGraphRegistry[ZoneSunkenTemple]
if !ok {
t.Fatal("zoneSunkenTempleGraph not registered")
}
if g.Entry != "sunken_temple.entry" {
t.Errorf("entry node = %q", g.Entry)
}
if g.Boss != "sunken_temple.boss" {
t.Errorf("boss node = %q", g.Boss)
}
if len(g.Nodes) != 10 {
t.Errorf("nodes = %d, want 10", len(g.Nodes))
}
}
// TestSunkenTempleGraph_FourDistinctPaths verifies the four leaves
// (kuo_toa_pen, glyph_chamber, aboleth_thralls, coral_reliquary) all
// reach the boss. Together with the no-merge invariant below, this
// confirms the design intent: four committed paths, not a diamond.
func TestSunkenTempleGraph_FourDistinctPaths(t *testing.T) {
g := zoneSunkenTempleGraph()
for _, leaf := range []string{
"sunken_temple.kuo_toa_pen",
"sunken_temple.glyph_chamber",
"sunken_temple.aboleth_thralls",
"sunken_temple.coral_reliquary",
} {
if !reachable(g, leaf, "sunken_temple.boss") {
t.Errorf("%s unreachable to boss", leaf)
}
}
}
// TestSunkenTempleGraph_NoMidPathMerge ensures no node other than the
// boss has more than one incoming edge. If a future edit collapses the
// two subtrees into a converging diamond, this test fails — that's the
// signal to either rename the zone's shape comment or re-author.
func TestSunkenTempleGraph_NoMidPathMerge(t *testing.T) {
g := zoneSunkenTempleGraph()
incoming := map[string]int{}
for _, outs := range g.Edges {
for _, e := range outs {
incoming[e.To]++
}
}
for id, n := range g.Nodes {
if n.IsBoss {
continue
}
if incoming[id] > 1 {
t.Errorf("node %q has %d incoming edges, want ≤1 (no mid-path merge)", id, incoming[id])
}
}
// Boss intentionally has 4 incoming edges (one per leaf).
if incoming["sunken_temple.boss"] != 4 {
t.Errorf("boss incoming = %d, want 4", incoming["sunken_temple.boss"])
}
}
func TestSunkenTempleGraph_LockKindCoverage(t *testing.T) {
g := zoneSunkenTempleGraph()
kinds := map[ZoneEdgeLockKind]bool{}
for _, outs := range g.Edges {
for _, e := range outs {
kinds[e.Lock] = true
}
}
// Sunken Temple deliberately exercises Perception + StatCheck +
// LockNone in one zone.
for _, k := range []ZoneEdgeLockKind{LockNone, LockPerception, LockStatCheck} {
if !kinds[k] {
t.Errorf("missing lock kind %s — variety check", k)
}
}
}