diff --git a/app/src/main/java/dev/synapsetech/compass/MainActivity.kt b/app/src/main/java/dev/synapsetech/compass/MainActivity.kt index 670e171..f992101 100644 --- a/app/src/main/java/dev/synapsetech/compass/MainActivity.kt +++ b/app/src/main/java/dev/synapsetech/compass/MainActivity.kt @@ -29,8 +29,7 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch - -private enum class Cardinal(val letter: String, val degree: Int) { +enum class Cardinal(val letter: String, val degree: Int) { NORTH("N", 0), EAST("E", 90), SOUTH("S", 180), diff --git a/app/src/test/java/dev/synapsetech/compass/CardinalEnumTest.kt b/app/src/test/java/dev/synapsetech/compass/CardinalEnumTest.kt new file mode 100644 index 0000000..360879a --- /dev/null +++ b/app/src/test/java/dev/synapsetech/compass/CardinalEnumTest.kt @@ -0,0 +1,27 @@ +package dev.synapsetech.compass + +import org.junit.Test + +import org.junit.Assert.* + +class CardinalEnumTest { + @Test + fun detection_isCorrect() { + assertEquals(Cardinal.NORTH, Cardinal.fromDegree(0)) + assertEquals(Cardinal.NORTH, Cardinal.fromDegree(360)) + assertEquals(Cardinal.NORTH, Cardinal.fromDegree(10)) + assertEquals(Cardinal.NORTH, Cardinal.fromDegree(350)) + + assertEquals(Cardinal.EAST, Cardinal.fromDegree(90)) + assertEquals(Cardinal.EAST, Cardinal.fromDegree(83)) + assertEquals(Cardinal.EAST, Cardinal.fromDegree(99)) + + assertEquals(Cardinal.SOUTH, Cardinal.fromDegree(180)) + assertEquals(Cardinal.SOUTH, Cardinal.fromDegree(172)) + assertEquals(Cardinal.SOUTH, Cardinal.fromDegree(194)) + + assertEquals(Cardinal.WEST, Cardinal.fromDegree(270)) + assertEquals(Cardinal.WEST, Cardinal.fromDegree(267)) + assertEquals(Cardinal.WEST, Cardinal.fromDegree(286)) + } +} \ No newline at end of file diff --git a/app/src/test/java/dev/synapsetech/compass/ExampleUnitTest.kt b/app/src/test/java/dev/synapsetech/compass/ExampleUnitTest.kt deleted file mode 100644 index 2415b47..0000000 --- a/app/src/test/java/dev/synapsetech/compass/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package dev.synapsetech.compass - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file