refactor(tests): improve FEN and PGN parser test cases for clarity and coverage
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
package de.nowchess.ui.utils
|
||||
|
||||
import de.nowchess.api.board.Piece
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
|
||||
class PieceUnicodeTest extends AnyFunSuite with Matchers:
|
||||
|
||||
test("White King maps to ♔"):
|
||||
Piece.WhiteKing.unicode shouldBe "\u2654"
|
||||
|
||||
test("White Queen maps to ♕"):
|
||||
Piece.WhiteQueen.unicode shouldBe "\u2655"
|
||||
|
||||
test("White Rook maps to ♖"):
|
||||
Piece.WhiteRook.unicode shouldBe "\u2656"
|
||||
|
||||
test("White Bishop maps to ♗"):
|
||||
Piece.WhiteBishop.unicode shouldBe "\u2657"
|
||||
|
||||
test("White Knight maps to ♘"):
|
||||
Piece.WhiteKnight.unicode shouldBe "\u2658"
|
||||
|
||||
test("White Pawn maps to ♙"):
|
||||
Piece.WhitePawn.unicode shouldBe "\u2659"
|
||||
|
||||
test("Black King maps to ♚"):
|
||||
Piece.BlackKing.unicode shouldBe "\u265A"
|
||||
|
||||
test("Black Queen maps to ♛"):
|
||||
Piece.BlackQueen.unicode shouldBe "\u265B"
|
||||
|
||||
test("Black Rook maps to ♜"):
|
||||
Piece.BlackRook.unicode shouldBe "\u265C"
|
||||
|
||||
test("Black Bishop maps to ♝"):
|
||||
Piece.BlackBishop.unicode shouldBe "\u265D"
|
||||
|
||||
test("Black Knight maps to ♞"):
|
||||
Piece.BlackKnight.unicode shouldBe "\u265E"
|
||||
|
||||
test("Black Pawn maps to ♟"):
|
||||
Piece.BlackPawn.unicode shouldBe "\u265F"
|
||||
@@ -1,41 +0,0 @@
|
||||
package de.nowchess.ui.utils
|
||||
|
||||
import de.nowchess.api.board.*
|
||||
import org.scalatest.funsuite.AnyFunSuite
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
|
||||
class RendererTest extends AnyFunSuite with Matchers:
|
||||
|
||||
test("render contains column header with all file labels"):
|
||||
Renderer.render(Board.initial) should include("a b c d e f g h")
|
||||
|
||||
test("render output begins with the column header"):
|
||||
Renderer.render(Board.initial) should startWith(" a b c d e f g h")
|
||||
|
||||
test("render contains rank labels 1 through 8"):
|
||||
val output = Renderer.render(Board.initial)
|
||||
for rank <- 1 to 8 do output should include(s"$rank ")
|
||||
|
||||
test("render shows white king unicode symbol for initial board"):
|
||||
Renderer.render(Board.initial) should include("\u2654")
|
||||
|
||||
test("render shows black king unicode symbol for initial board"):
|
||||
Renderer.render(Board.initial) should include("\u265A")
|
||||
|
||||
test("render contains ANSI light-square background code"):
|
||||
Renderer.render(Board.initial) should include("\u001b[48;5;223m")
|
||||
|
||||
test("render contains ANSI dark-square background code"):
|
||||
Renderer.render(Board.initial) should include("\u001b[48;5;130m")
|
||||
|
||||
test("render uses white-piece foreground color for white pieces"):
|
||||
Renderer.render(Board.initial) should include("\u001b[97m")
|
||||
|
||||
test("render uses black-piece foreground color for black pieces"):
|
||||
Renderer.render(Board.initial) should include("\u001b[30m")
|
||||
|
||||
test("render of empty board contains no piece unicode"):
|
||||
val output = Renderer.render(Board(Map.empty))
|
||||
output should include("a b c d e f g h")
|
||||
output should not include "\u2654"
|
||||
output should not include "\u265A"
|
||||
Reference in New Issue
Block a user