File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,7 @@ enum class Rotation(val value: Int) {
99 RIGHT (1 ),
1010 MIRROR (2 ),
1111 LEFT (3 );
12+
13+ fun rotate (rotation : Rotation ): Rotation =
14+ Rotation .values()[(Rotation .values().size + value + rotation.value) % Rotation .values().size]
1215}
Original file line number Diff line number Diff line change 1+ package sc.plugin2021
2+
3+ import io.kotlintest.shouldBe
4+ import io.kotlintest.specs.StringSpec
5+
6+ class RotationTest : StringSpec ({
7+ " Rotations can get rotated" {
8+ Rotation .values().forEach {
9+ it.rotate(Rotation .NONE ) shouldBe it
10+ Rotation .NONE .rotate(it) shouldBe it
11+ it.rotate(Rotation .RIGHT ).rotate(Rotation .LEFT ) shouldBe it
12+ it.rotate(Rotation .MIRROR ).rotate(Rotation .MIRROR ) shouldBe it
13+ it.rotate(Rotation .LEFT ).rotate(Rotation .LEFT ) shouldBe it.rotate(Rotation .MIRROR )
14+ }
15+ }
16+ })
You can’t perform that action at this time.
0 commit comments