Skip to content

Commit 2d8a5a0

Browse files
committed
test(plugin): add test for GameState deserialization from replay string
1 parent 2a733b0 commit 2d8a5a0

File tree

2 files changed

+198
-180
lines changed

2 files changed

+198
-180
lines changed

plugin/src/shared/sc/plugin2021/GameState.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ class GameState @JvmOverloads constructor(
182182
return result
183183
}
184184

185+
override fun toString(): String =
186+
if (validColors.isEmpty()) "GameState finished at $round/$turn"
187+
else "GameState $round/$turn -> $currentColor ${if (GameRuleLogic.isFirstMove(this)) "(Start Piece: $startPiece)" else ""}"
188+
185189
fun longString(): String =
186190
"GameState(first=$first, second=$second, turn=$turn, validColors=$validColors, startPiece=$startPiece, lastMove=$lastMove, lastMoveMono=$lastMoveMono)\n" +
187191
"undeployedPieceShapes=${Color.values().associateWith { undeployedPieceShapes(it) }}\n" +
188192
"$board"
189193

190-
override fun toString(): String =
191-
if (validColors.isEmpty()) "GameState finished at $round/$turn"
192-
else "GameState $round/$turn -> $currentColor ${if (GameRuleLogic.isFirstMove(this)) "(Start Piece: $startPiece)" else ""}"
193-
194194
}
195195

196196
fun <T> Array<T>.toLinkedHashSet() = toCollection(LinkedHashSet(size))

0 commit comments

Comments
 (0)