diff options
| author | historia <[not public]> | 2026-07-09 05:27:10 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-09 05:27:10 -0400 |
| commit | c705ae942573984784ef501bf8198f61f5206ddd (patch) | |
| tree | c964066f3a244002bf75cb50a877630f46496f81 /internal/world/insert_remove_test.go | |
| parent | 74153c7814fc4cef988066ef04e38731a943bc12 (diff) | |
| download | thehouseoficarus-c705ae942573984784ef501bf8198f61f5206ddd.tar.gz | |
refactor: simplify yaml, remove support for old scalar fields
Diffstat (limited to 'internal/world/insert_remove_test.go')
| -rw-r--r-- | internal/world/insert_remove_test.go | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/internal/world/insert_remove_test.go b/internal/world/insert_remove_test.go index 3be3222..15d752e 100644 --- a/internal/world/insert_remove_test.go +++ b/internal/world/insert_remove_test.go @@ -9,8 +9,8 @@ const insertSentinel = 9999 func TestInsertGridConflictsCleanNSEW(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n east: 2\n") - writeGridTestRoom(t, dir, 2, "exits:\n west: 1\n") + writeGridTestRoom(t, dir, 1, "exits:\n east: {room: 2}\n") + writeGridTestRoom(t, dir, 2, "exits:\n west: {room: 1}\n") w := New(dir) if c := InsertGridConflicts(1, East, 2, insertSentinel, loadGridRoom(w)); len(c) != 0 { t.Errorf("clean east insert: expected no conflicts, got %+v", c) @@ -19,8 +19,8 @@ func TestInsertGridConflictsCleanNSEW(t *testing.T) { func TestInsertGridConflictsCleanDiagonal(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n northeast: 2\n") - writeGridTestRoom(t, dir, 2, "exits:\n southwest: 1\n") + writeGridTestRoom(t, dir, 1, "exits:\n northeast: {room: 2}\n") + writeGridTestRoom(t, dir, 2, "exits:\n southwest: {room: 1}\n") w := New(dir) if c := InsertGridConflicts(1, Northeast, 2, insertSentinel, loadGridRoom(w)); len(c) != 0 { t.Errorf("clean NE insert: expected no conflicts, got %+v", c) @@ -29,8 +29,8 @@ func TestInsertGridConflictsCleanDiagonal(t *testing.T) { func TestInsertGridConflictsCleanUpDown(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n up: 2\n") - writeGridTestRoom(t, dir, 2, "exits:\n down: 1\n") + writeGridTestRoom(t, dir, 1, "exits:\n up: {room: 2}\n") + writeGridTestRoom(t, dir, 2, "exits:\n down: {room: 1}\n") w := New(dir) if c := InsertGridConflicts(1, Up, 2, insertSentinel, loadGridRoom(w)); len(c) != 0 { t.Errorf("clean up insert: expected no conflicts, got %+v", c) @@ -73,14 +73,14 @@ func TestInsertGridConflictsCleanUpDown(t *testing.T) { // beyond-set (reachable from 1 via south, not via east/2), so it's an overlap. func TestInsertGridConflictsOverlap(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n east: 2\n south: 4\n") - writeGridTestRoom(t, dir, 2, "exits:\n east: 3\n west: 1\n") - writeGridTestRoom(t, dir, 3, "exits:\n west: 2\n") - writeGridTestRoom(t, dir, 4, "exits:\n east: 5\n north: 1\n") - writeGridTestRoom(t, dir, 5, "exits:\n east: 6\n west: 4\n") - writeGridTestRoom(t, dir, 6, "exits:\n east: 7\n west: 5\n") - writeGridTestRoom(t, dir, 7, "exits:\n north: 8\n west: 6\n") - writeGridTestRoom(t, dir, 8, "exits:\n south: 7\n") + writeGridTestRoom(t, dir, 1, "exits:\n east: {room: 2}\n south: {room: 4}\n") + writeGridTestRoom(t, dir, 2, "exits:\n east: {room: 3}\n west: {room: 1}\n") + writeGridTestRoom(t, dir, 3, "exits:\n west: {room: 2}\n") + writeGridTestRoom(t, dir, 4, "exits:\n east: {room: 5}\n north: {room: 1}\n") + writeGridTestRoom(t, dir, 5, "exits:\n east: {room: 6}\n west: {room: 4}\n") + writeGridTestRoom(t, dir, 6, "exits:\n east: {room: 7}\n west: {room: 5}\n") + writeGridTestRoom(t, dir, 7, "exits:\n north: {room: 8}\n west: {room: 6}\n") + writeGridTestRoom(t, dir, 8, "exits:\n south: {room: 7}\n") w := New(dir) // Sanity: the pre-edit world must be clean. @@ -101,11 +101,11 @@ func TestInsertGridConflictsOverlap(t *testing.T) { // insert helper must surface a twist conflict. func TestInsertGridConflictsTwist(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n east: 2\n south: 4\n") - writeGridTestRoom(t, dir, 2, "exits:\n east: 3\n west: 1\n") - writeGridTestRoom(t, dir, 3, "exits:\n west: 2\n south: 5\n") - writeGridTestRoom(t, dir, 4, "exits:\n east: 5\n north: 1\n") - writeGridTestRoom(t, dir, 5, "exits:\n north: 3\n west: 4\n") + writeGridTestRoom(t, dir, 1, "exits:\n east: {room: 2}\n south: {room: 4}\n") + writeGridTestRoom(t, dir, 2, "exits:\n east: {room: 3}\n west: {room: 1}\n") + writeGridTestRoom(t, dir, 3, "exits:\n west: {room: 2}\n south: {room: 5}\n") + writeGridTestRoom(t, dir, 4, "exits:\n east: {room: 5}\n north: {room: 1}\n") + writeGridTestRoom(t, dir, 5, "exits:\n north: {room: 3}\n west: {room: 4}\n") w := New(dir) c := InsertGridConflicts(1, East, 2, insertSentinel, loadGridRoom(w)) @@ -120,7 +120,7 @@ func TestInsertGridConflictsTwist(t *testing.T) { // geometrically clean insert. func TestInsertGridConflictsOneWayFarReciprocal(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n east: 2\n") + writeGridTestRoom(t, dir, 1, "exits:\n east: {room: 2}\n") writeGridTestRoom(t, dir, 2, "exits:\n") // no west exit back to 1 w := New(dir) if c := InsertGridConflicts(1, East, 2, insertSentinel, loadGridRoom(w)); len(c) != 0 { @@ -131,9 +131,9 @@ func TestInsertGridConflictsOneWayFarReciprocal(t *testing.T) { func TestRemoveGridConflictsCleanPull(t *testing.T) { dir := t.TempDir() // 1 east→2 east→3, with reciprocals. Removing 2 pulls 3 to (1,0,0). Clean. - writeGridTestRoom(t, dir, 1, "exits:\n east: 2\n") - writeGridTestRoom(t, dir, 2, "exits:\n east: 3\n west: 1\n") - writeGridTestRoom(t, dir, 3, "exits:\n west: 2\n") + writeGridTestRoom(t, dir, 1, "exits:\n east: {room: 2}\n") + writeGridTestRoom(t, dir, 2, "exits:\n east: {room: 3}\n west: {room: 1}\n") + writeGridTestRoom(t, dir, 3, "exits:\n west: {room: 2}\n") w := New(dir) if c := RemoveGridConflicts(1, East, loadGridRoom(w)); len(c) != 0 { t.Errorf("clean pull should produce no conflicts, got %+v", c) @@ -142,9 +142,9 @@ func TestRemoveGridConflictsCleanPull(t *testing.T) { func TestRemoveGridConflictsDiagonalPull(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n northeast: 2\n") - writeGridTestRoom(t, dir, 2, "exits:\n northeast: 3\n southwest: 1\n") - writeGridTestRoom(t, dir, 3, "exits:\n southwest: 2\n") + writeGridTestRoom(t, dir, 1, "exits:\n northeast: {room: 2}\n") + writeGridTestRoom(t, dir, 2, "exits:\n northeast: {room: 3}\n southwest: {room: 1}\n") + writeGridTestRoom(t, dir, 3, "exits:\n southwest: {room: 2}\n") w := New(dir) if c := RemoveGridConflicts(1, Northeast, loadGridRoom(w)); len(c) != 0 { t.Errorf("clean diagonal pull should produce no conflicts, got %+v", c) @@ -155,12 +155,12 @@ func TestRemoveGridConflictsDiagonalPull(t *testing.T) { // removing 2 pulls 6 onto 5's cell. func TestRemoveGridConflictsOverlap(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n east: 2\n south: 4\n") - writeGridTestRoom(t, dir, 2, "exits:\n east: 3\n west: 1\n") - writeGridTestRoom(t, dir, 3, "exits:\n south: 6\n west: 2\n") - writeGridTestRoom(t, dir, 4, "exits:\n east: 5\n north: 1\n") - writeGridTestRoom(t, dir, 5, "exits:\n west: 4\n") - writeGridTestRoom(t, dir, 6, "exits:\n north: 3\n") + writeGridTestRoom(t, dir, 1, "exits:\n east: {room: 2}\n south: {room: 4}\n") + writeGridTestRoom(t, dir, 2, "exits:\n east: {room: 3}\n west: {room: 1}\n") + writeGridTestRoom(t, dir, 3, "exits:\n south: {room: 6}\n west: {room: 2}\n") + writeGridTestRoom(t, dir, 4, "exits:\n east: {room: 5}\n north: {room: 1}\n") + writeGridTestRoom(t, dir, 5, "exits:\n west: {room: 4}\n") + writeGridTestRoom(t, dir, 6, "exits:\n north: {room: 3}\n") w := New(dir) if c := BuildGridConflicts(1, loadGridRoom(w)); len(c) != 0 { @@ -177,8 +177,8 @@ func TestRemoveGridConflictsOverlap(t *testing.T) { // world this cannot introduce a conflict. func TestRemoveGridConflictsDeadEnd(t *testing.T) { dir := t.TempDir() - writeGridTestRoom(t, dir, 1, "exits:\n east: 2\n") - writeGridTestRoom(t, dir, 2, "exits:\n west: 1\n") + writeGridTestRoom(t, dir, 1, "exits:\n east: {room: 2}\n") + writeGridTestRoom(t, dir, 2, "exits:\n west: {room: 1}\n") w := New(dir) if c := RemoveGridConflicts(1, East, loadGridRoom(w)); len(c) != 0 { t.Errorf("dead-end removal should produce no conflicts, got %+v", c) |
