@@ -7,7 +7,6 @@ import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
77import io.kotest.matchers.shouldBe
88import sc.plugin2021.util.Constants
99import sc.plugin2021.util.GameRuleLogic
10- import sc.plugin2021.util.filterValidMoves
1110import sc.shared.InvalidMoveException
1211
1312class GameRuleLogicTest : WordSpec ({
@@ -103,7 +102,7 @@ class GameRuleLogicTest: WordSpec({
103102 val piece = PieceShape .PENTO_W
104103 var state = GameState (startPiece = piece)
105104 " return all possible moves that can be placed in a free corner" {
106- var SHOULD = setOf (
105+ var SHOULD : Collection < Move > = listOf (
107106 Piece (Color .BLUE , piece, Rotation .NONE , false, Coordinates (0, 0)),
108107 Piece (Color .BLUE , piece, Rotation .MIRROR , false, Coordinates (0, 0)),
109108 Piece (Color .BLUE , piece, Rotation .RIGHT , false, Coordinates (17, 0)),
@@ -112,47 +111,47 @@ class GameRuleLogicTest: WordSpec({
112111 Piece (Color .BLUE , piece, Rotation .MIRROR , false, Coordinates (17, 17)),
113112 Piece (Color .BLUE , piece, Rotation .RIGHT , false, Coordinates (0, 17)),
114113 Piece (Color .BLUE , piece, Rotation .LEFT , false, Coordinates (0, 17))
115- ).map { SetMove (it) }.toSet()
114+ ).map { SetMove (it) }
116115 var IS = GameRuleLogic .getPossibleMoves(state)
117-
116+
118117 IS shouldContainExactlyInAnyOrder SHOULD
119118 GameRuleLogic .performMove(state, SHOULD .first())
120-
121- SHOULD = setOf (
119+
120+ SHOULD = listOf (
122121 Piece (Color .YELLOW , piece, Rotation .RIGHT , false, Coordinates (17, 0)),
123122 Piece (Color .YELLOW , piece, Rotation .LEFT , false, Coordinates (17, 0)),
124123 Piece (Color .YELLOW , piece, Rotation .NONE , false, Coordinates (17, 17)),
125124 Piece (Color .YELLOW , piece, Rotation .MIRROR , false, Coordinates (17, 17)),
126125 Piece (Color .YELLOW , piece, Rotation .RIGHT , false, Coordinates (0, 17)),
127126 Piece (Color .YELLOW , piece, Rotation .LEFT , false, Coordinates (0, 17))
128- ).map { SetMove (it) }.toSet()
127+ ).map { SetMove (it) }
129128 IS = GameRuleLogic .getPossibleMoves(state)
130-
129+
131130 IS shouldContainExactlyInAnyOrder SHOULD
132131 GameRuleLogic .performMove(state, SHOULD .first())
133-
132+
134133 SHOULD = setOf(
135134 Piece (Color .RED , piece, Rotation .NONE , false, Coordinates (17, 17)),
136135 Piece (Color .RED , piece, Rotation .MIRROR , false, Coordinates (17, 17)),
137136 Piece (Color .RED , piece, Rotation .RIGHT , false, Coordinates (0, 17)),
138137 Piece (Color .RED , piece, Rotation .LEFT , false, Coordinates (0, 17))
139- ).map { SetMove (it) }.toSet()
138+ ).map { SetMove (it) }
140139 IS = GameRuleLogic .getPossibleMoves(state)
141-
140+
142141 IS shouldContainExactlyInAnyOrder SHOULD
143142 GameRuleLogic .performMove(state, SHOULD .first())
144-
145- SHOULD = setOf (
143+
144+ SHOULD = listOf (
146145 Piece (Color .GREEN , piece, Rotation .RIGHT , false, Coordinates (0, 17)),
147146 Piece (Color .GREEN , piece, Rotation .LEFT , false, Coordinates (0, 17))
148- ).map { SetMove (it) }.toSet()
147+ ).map { SetMove (it) }
149148 IS = GameRuleLogic .getPossibleMoves(state)
150-
149+
151150 IS shouldContainExactlyInAnyOrder SHOULD
152-
151+
153152 state = GameState ()
154153 GameRuleLogic .getPossibleMoves(state) shouldContainExactlyInAnyOrder
155- GameRuleLogic .getPossibleMoves(state).filterValidMoves (state)
154+ GameRuleLogic .getPossibleMoves(state).filter { GameRuleLogic .isValidSetMove (state, it) }
156155 }
157156 }
158157})
0 commit comments