Added 3 new tests for missing error paths:
- Invalid en passant square parsing (e.g., "x5")
- Half-move clock non-integer (e.g., "abc")
- Full-move number non-integer (e.g., "abc")
Updated 3 existing error tests to verify error messages:
- "expected 6" for invalid parts count
- "color" for invalid active color
- "castling" for invalid castling rights
All error assertions now use .fold() to verify message content, improving test robustness. Test count increased from 19 to 22.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
FenParser.parseFen now returns Either[String, GameContext] instead of Option.
Updated all tests to use Either combinators (isRight, isLeft, fold) instead
of Option methods (isDefined, get). Both FenParserTest and FenExporterTest
now properly handle the Either-based return type.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update parseFen to return Either[String, GameContext] with specific error messages for each validation failure:
- Invalid parts count: reports expected 6 fields
- Invalid board: clear message about board position
- Invalid color: explains expected 'w' or 'b'
- Invalid castling, en passant, and move counts with clear descriptions
Simplify importGameContext to delegate directly to parseFen.
Keep helper methods (parseColor, parseCastling, parseEnPassant, etc.) returning Option as before.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update GameContextExport trait to use Scala 3 syntax (colon-based) to match GameContextImport
- Add test coverage for FenParser.importGameContext method:
* Valid FEN string returns Right[GameContext] with correct context data
* Invalid FEN string returns Left[String] with error message
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update GameContextImport trait to return Either[String, GameContext] instead of
Option[GameContext] to provide better error context during parsing. Update FenParser
implementation to convert Option to Either using toRight().
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>