From 9e4e259a8096700f93900314fe299ae488d3110a Mon Sep 17 00:00:00 2001 From: Pablo Fraile Alonso Date: Thu, 17 Feb 2022 16:22:05 +0100 Subject: [PATCH] feat(iblock): add y axis positions --- src/main/kotlin/IBlock.kt | 4 ++-- src/test/kotlin/IBlockTest.kt | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) 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