-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lblock): implement simple movement
- Loading branch information
1 parent
3897c44
commit b5c7ea9
Showing
2 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package blocks.LBlock | ||
|
||
import blocks.Block | ||
import blocks.MoveTest | ||
import blocks.implementation.LBlock | ||
import movements.Direction | ||
import movements.Position | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import kotlin.test.assertEquals | ||
|
||
class LBlockMoveTest : MoveTest { | ||
|
||
private lateinit var lBlock: Block | ||
|
||
@BeforeEach | ||
fun setUp() { | ||
lBlock = LBlock(Position(2, 2)) | ||
} | ||
|
||
@Test | ||
override fun `Move to Right changes column plus one`() { | ||
lBlock.move(Direction.RIGHT) | ||
assertEquals( | ||
listOf(Position(2, 3), Position(3, 3), Position(4, 3), Position(4, 4)), | ||
lBlock.getNeededPositions() | ||
) | ||
} | ||
|
||
@Test | ||
override fun `Double move to Right changes column plus two`() { | ||
lBlock.move(Direction.RIGHT) | ||
lBlock.move(Direction.RIGHT) | ||
assertEquals( | ||
listOf(Position(2, 4), Position(3, 4), Position(4, 4), Position(4, 5)), | ||
lBlock.getNeededPositions() | ||
) | ||
} | ||
|
||
@Test | ||
override fun `Move to Left changes column minus one`() { | ||
lBlock.move(Direction.LEFT) | ||
assertEquals( | ||
listOf(Position(2, 1), Position(3, 1), Position(4, 1), Position(4, 2)), | ||
lBlock.getNeededPositions() | ||
) | ||
} | ||
|
||
@Test | ||
override fun `Double move to Left changes column minus two`() { | ||
lBlock.move(Direction.LEFT) | ||
lBlock.move(Direction.LEFT) | ||
assertEquals( | ||
listOf(Position(2, 0), Position(3, 0), Position(4, 0), Position(4, 1)), | ||
lBlock.getNeededPositions() | ||
) | ||
} | ||
|
||
@Test | ||
override fun `Move down changes row plus one`() { | ||
lBlock.move(Direction.DOWN) | ||
assertEquals( | ||
listOf(Position(3, 2), Position(4, 2), Position(5, 2), Position(5, 3)), | ||
lBlock.getNeededPositions() | ||
) | ||
} | ||
|
||
@Test | ||
override fun `Double move Down changes row plus two`() { | ||
lBlock.move(Direction.DOWN) | ||
lBlock.move(Direction.DOWN) | ||
assertEquals( | ||
listOf(Position(4, 2), Position(5, 2), Position(6, 2), Position(6, 3)), | ||
lBlock.getNeededPositions() | ||
) | ||
} | ||
} |