Skip to content

test: add Game current position invariant coverage#119

Draft
CorentinGS wants to merge 1 commit into
feat/uci-adapter-seamfrom
feat/game-current-position-invariants
Draft

test: add Game current position invariant coverage#119
CorentinGS wants to merge 1 commit into
feat/uci-adapter-seamfrom
feat/game-current-position-invariants

Conversation

@CorentinGS
Copy link
Copy Markdown
Owner

@CorentinGS CorentinGS commented Jun 3, 2026

Summary

  • Adds test-only Game current-position invariant coverage for construction, move application, navigation, minimal PGN parsing, cloning, and splitting.
  • Fixes Game.Clone() to preserve the current cursor and keep Position(), CurrentPosition(), g.pos, and currentMove.position consistent.
  • Completes the first implementation slice from local Issue 002: Deepen the Game Module.

Verification

  • go test ./...

@CorentinGS CorentinGS force-pushed the feat/uci-adapter-seam branch from 167f09a to 13ec153 Compare June 3, 2026 07:43
@CorentinGS CorentinGS force-pushed the feat/game-current-position-invariants branch from 71524c3 to 230454f Compare June 3, 2026 07:43
@CorentinGS CorentinGS requested a review from Copilot June 3, 2026 07:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Game.Clone() correctness by preserving the game’s current move cursor (and corresponding current position) when cloning, and adds invariant-focused tests to ensure Game consistently reports its current position across common operations.

Changes:

  • Update Game.Clone() to map g.currentMove into the cloned move tree (instead of defaulting to the last mainline move).
  • Ensure cloned games’ pos tracks the cloned currentMove.position.
  • Add invariant tests covering current-position consistency after cloning, navigation, PGN parsing, and Split().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
game.go Fixes clone behavior by preserving the current move cursor via a move-tree search and syncing pos to the cloned cursor position.
game_invariants_test.go Adds tests asserting Game’s “current position” invariants across clone/navigation/PGN/split workflows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CorentinGS CorentinGS force-pushed the feat/uci-adapter-seam branch from 13ec153 to 93c8d1f Compare June 3, 2026 08:03
@CorentinGS CorentinGS force-pushed the feat/game-current-position-invariants branch from 230454f to 966ebee Compare June 3, 2026 08:03
@CorentinGS CorentinGS force-pushed the feat/uci-adapter-seam branch from 93c8d1f to 222d597 Compare June 3, 2026 08:10
@CorentinGS CorentinGS force-pushed the feat/game-current-position-invariants branch from 966ebee to 8bca1f0 Compare June 3, 2026 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants