diff --git a/src/main/kotlin/IBlock.kt b/src/main/kotlin/IBlock.kt index aaaf59e..898548a 100644 --- a/src/main/kotlin/IBlock.kt +++ b/src/main/kotlin/IBlock.kt @@ -1,7 +1,7 @@ -class IBlock(position: Position) { +class IBlock(val position: Position) { fun getNeededPositions(): List { - return listOf(Position(0,0), Position(0, 1), Position(0, 2), Position(0, 3)) + return listOf(Position(0, this.position.y), Position(0, this.position.y + 1), Position(0, this.position.y + 2), Position(0, this.position.y + 3)) } } diff --git a/src/test/kotlin/IBlockTest.kt b/src/test/kotlin/IBlockTest.kt index 185d386..a33caa1 100644 --- a/src/test/kotlin/IBlockTest.kt +++ b/src/test/kotlin/IBlockTest.kt @@ -12,4 +12,13 @@ class IBlockTest { ) } + @Test + fun `position 0,1 needed positions are (0,1), (0,2), (0,3), (0,4)`() { + val iBlock: IBlock = IBlock(Position(0, 1)) + assertEquals( + listOf(Position(0, 1), Position(0, 2), Position(0, 3), Position(0, 4)), + iBlock.getNeededPositions() + ) + } + } \ No newline at end of file