Compare commits

..

20 Commits

Author SHA1 Message Date
Janis c75a3a28af test: add tests for undo and redo notifications in GameEngine
Build & Test (NowChessSystems) TeamCity build finished
2026-03-31 09:34:39 +02:00
Janis 40086a331f fix: improve TerminalUI coverage and make MoveCommand/ResetCommand immutable
**TerminalUI Coverage Fix:**
- Added explicit test for empty input case (lines 64-65 previously uncovered)
- Test "TerminalUI should explicitly handle empty input by re-prompting" validates
  that multiple empty inputs are properly handled by re-prompting
- UI module coverage improved to near-100%

**MoveCommand Immutability (Anti-pattern Fix):**
- Changed MoveCommand fields from var to val: moveResult, previousBoard,
  previousHistory, previousTurn
- Changed ResetCommand fields from var to val: previousBoard, previousHistory,
  previousTurn
- Updated GameEngine to use .copy() instead of direct mutation when updating
  command state (lines 88, 95, 103, 112)
- Removed 3 edge-case tests that relied on command mutation (now impossible with
  immutable fields)

**MoveCommand Immutability Tests:**
- Added MoveCommandImmutabilityTest to verify:
  - Fields cannot be mutated after creation
  - equals/hashCode respect immutability invariant
  - .copy() creates new instances with updated values

All tests pass; 100% core coverage maintained.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-31 08:43:44 +02:00
Janis 8f64273ceb fix: add thread-safety synchronization to Observable and CommandInvoker
Test-driven fixes for code review blockers NCS-16:

**Observable (CRITICAL):** Added synchronized blocks to subscribe, unsubscribe,
notifyObservers, and observerCount to prevent race conditions when concurrent
threads register observers while notifications are dispatched.

**CommandInvoker (IMPORTANT):** Added synchronized blocks to all methods
(execute, undo, redo, history, getCurrentIndex, canUndo, canRedo, clear) to
ensure atomic access to mutable state (executedCommands, currentIndex).

Tests:
- Added ObservableThreadSafetyTest: 3 tests for concurrent subscribe/unsubscribe/notify
- Added CommandInvokerThreadSafetyTest: 2 tests for concurrent execute/undo/redo
- All 54 existing tests remain green
- Full build passes with 100% core coverage

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-31 08:32:15 +02:00
Janis 418e45e805 refactor: simplify undo and redo logic in GameEngine and removed Hacky Test
Build & Test (NowChessSystems) TeamCity build failed
2026-03-30 22:38:13 +02:00
shahdlala66 41b53d1dee test: added UI model tests
Build & Test (NowChessSystems) TeamCity build failed
2026-03-30 22:32:57 +02:00
shahdlala66 75f2363517 fix: PR issues fixed
Build & Test (NowChessSystems) TeamCity build failed
2026-03-30 21:48:04 +02:00
shahdlala66 ab96aee3ea test: 100%
Build & Test (NowChessSystems) TeamCity build failed
2026-03-30 21:42:52 +02:00
shahdlala66 5499d528de fix: removing the scala metal folder
Build & Test (NowChessSystems) TeamCity build failed
2026-03-30 19:44:02 +02:00
shahdlala66 7f44c07c23 fix: removing metal folder
Build & Test (NowChessSystems) TeamCity build failed
2026-03-30 19:37:17 +02:00
shahdlala66 5278de96a5 test: reached 99% for GameEngine
Build & Test (NowChessSystems) TeamCity build failed
2026-03-30 00:32:10 +02:00
shahdlala66 f0cd46f132 test: more branch coverage for CommandInvoker
Build & Test (NowChessSystems) TeamCity build finished
2026-03-29 21:08:07 +02:00
shahdlala66 9c1acfc9db feat: undo/redo added 2026-03-29 20:58:33 +02:00
shahdlala66 d2f294294f feat: core sepration, observer added 2026-03-29 20:47:58 +02:00
Janis 7d60c4bb29 feat: enhance FEN and PGN parsers with additional test cases and coverage improvements 2026-03-29 17:49:05 +02:00
Janis 60b02d8f20 style: replace .isDefined/.get with pattern matching in PgnParser
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 17:14:41 +02:00
Janis 9bc1ef550f feat: add PGN exporter for game notation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 17:14:41 +02:00
Janis 98896535ed feat: add PGN parser with algebraic move notation
Implements PgnParser with parsePgn(), parseAlgebraicMove(), and move
resolution using geometric piece reachability with disambiguation support
for piece type, file, and rank hints.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-29 17:13:16 +02:00
Janis 18c712d5c9 feat: add full FEN parsing with GameState support
Implements parseFen() in FenParser and gameStateToFen() in FenExporter,
covering all 6 FEN fields (piece placement, active color, castling,
en passant, half-move clock, full-move number).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 17:12:29 +02:00
Janis ade9d14ddc feat: add FEN exporter and round-trip tests
Implements FenExporter.boardToFen() converting Board to FEN piece-placement string,
and adds three round-trip tests (initial position, empty board, partial position).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 17:11:31 +02:00
Janis 5db1405066 feat: add FEN piece-placement parser
Implements FenParser.parseBoard() to parse FEN piece-placement strings
into a Board, with proper None propagation on invalid input.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-29 17:11:13 +02:00
4 changed files with 2 additions and 20 deletions
-1
View File
@@ -1,4 +1,3 @@
## (2026-03-27) ## (2026-03-27)
## (2026-03-28) ## (2026-03-28)
## (2026-03-28) ## (2026-03-28)
## (2026-03-29)
+1 -1
View File
@@ -1,3 +1,3 @@
MAJOR=0 MAJOR=0
MINOR=0 MINOR=0
PATCH=4 PATCH=3
-17
View File
@@ -44,20 +44,3 @@
* add missing kings to gameLoop capture test board ([aedd787](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/aedd787b77203c2af934751dba7b784eaf165032)) * add missing kings to gameLoop capture test board ([aedd787](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/aedd787b77203c2af934751dba7b784eaf165032))
* correct test board positions and captureOutput/withInput interaction ([f0481e2](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/f0481e2561b779df00925b46ee281dc36a795150)) * correct test board positions and captureOutput/withInput interaction ([f0481e2](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/f0481e2561b779df00925b46ee281dc36a795150))
* update main class path in build configuration and adjust VCS directory mapping ([7b1f8b1](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/7b1f8b117623d327232a1a92a8a44d18582e0189)) * update main class path in build configuration and adjust VCS directory mapping ([7b1f8b1](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/7b1f8b117623d327232a1a92a8a44d18582e0189))
## (2026-03-29)
### Features
* add GameRules stub with PositionStatus enum ([76d4168](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/76d4168038de23e5d6083d4e8f0504fbf31d15a3))
* add MovedInCheck/Checkmate/Stalemate MoveResult variants (stub dispatch) ([8b7ec57](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/8b7ec57e5ea6ee1615a1883848a426dc07d26364))
* implement GameRules with isInCheck, legalMoves, gameStatus ([94a02ff](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/94a02ff6849436d9496c70a0f16c21666dae8e4e))
* implement legal castling ([#1](https://git.janis-eccarius.de/NowChess/NowChessSystems/issues/1)) ([00d326c](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/00d326c1ba67711fbe180f04e1100c3f01dd0254))
* NCS-6 Implementing FEN & PGN ([#7](https://git.janis-eccarius.de/NowChess/NowChessSystems/issues/7)) ([f28e69d](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/f28e69dc181416aa2f221fdc4b45c2cda5efbf07))
* NCS-9 En passant implementation ([#8](https://git.janis-eccarius.de/NowChess/NowChessSystems/issues/8)) ([919beb3](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/919beb3b4bfa8caf2f90976a415fe9b19b7e9747))
* wire check/checkmate/stalemate into processMove and gameLoop ([5264a22](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/5264a225418b885c5e6ea6411b96f85e38837f6c))
### Bug Fixes
* add missing kings to gameLoop capture test board ([aedd787](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/aedd787b77203c2af934751dba7b784eaf165032))
* correct test board positions and captureOutput/withInput interaction ([f0481e2](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/f0481e2561b779df00925b46ee281dc36a795150))
* update main class path in build configuration and adjust VCS directory mapping ([7b1f8b1](https://git.janis-eccarius.de/NowChess/NowChessSystems/commit/7b1f8b117623d327232a1a92a8a44d18582e0189))
+1 -1
View File
@@ -1,3 +1,3 @@
MAJOR=0 MAJOR=0
MINOR=4 MINOR=3
PATCH=0 PATCH=0