Skip to content

Commit

Permalink
feat: add tests for BahireHasab and more tests for number conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
brookmg committed Jan 5, 2021
1 parent de4d97e commit 69420e4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/src/test/java/dev/abushakir/android/BahireHasabTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package dev.abushakir.android

import dev.abushakir.android.data.BahireHasab
import org.junit.Assert
import org.junit.Test

class BahireHasabTest {

@Test fun `testing bahire hasab methods`() {
val bh = BahireHasab(year = 2011)
Assert.assertEquals(25, bh.abekte())
Assert.assertEquals(5, bh.metkih())
Assert.assertEquals("የካቲት" to 11 , bh.nenewe())
Assert.assertEquals("የካቲት" to 11 , bh.getSingleBealOrTsom("ነነዌ"))
Assert.assertEquals("የካቲት" to 25 , bh.getSingleBealOrTsom("ዓቢይ ጾም"))
Assert.assertEquals("መጋቢት" to 22 , bh.getSingleBealOrTsom("ደብረ ዘይት"))
Assert.assertEquals("ሚያዝያ" to 13 , bh.getSingleBealOrTsom("ሆሣዕና"))
Assert.assertEquals("ሚያዝያ" to 18 , bh.getSingleBealOrTsom("ስቅለት"))
Assert.assertEquals("ሚያዝያ" to 20 , bh.getSingleBealOrTsom("ትንሳኤ"))
Assert.assertEquals("ግንቦት" to 14 , bh.getSingleBealOrTsom("ርክበ ካህናት"))
Assert.assertEquals("ግንቦት" to 29 , bh.getSingleBealOrTsom("ዕርገት"))
Assert.assertEquals("ሰኔ" to 9 , bh.getSingleBealOrTsom("ጰራቅሊጦስ"))
Assert.assertEquals("ሰኔ" to 10 , bh.getSingleBealOrTsom("ጾመ ሐዋርያት"))
Assert.assertEquals("ሰኔ" to 12 , bh.getSingleBealOrTsom("ጾመ ድህነት"))
Assert.assertEquals(25, bh.abekte())
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ class NumberConversionTest {
Assert.assertEquals("", result)
}

@Test fun `general number converter test`() {
val arabicNumberList = listOf(1, 10, 15, 20, 25, 78, 105, 333, 450, 600, 1000, 1001, 1010, 1056, 1200, 2013, 9999, 10000)
val geezNumberList = listOf("", "", "፲፭", "", "፳፭", "፸፰", "፻፭", "፫፻፴፫", "፬፻፶", "፮፻", "፲፻", "፲፻፩", "፲፻፲", "፲፻፶፮", "፲፪፻", "፳፻፲፫", "፺፱፻፺፱", "፻፻")

for (i in arabicNumberList.indices) {
Assert.assertEquals(geezNumberList[i] , ConversionLogic.convertToEthiopic(arabicNumberList[i]))
}
}
}

0 comments on commit 69420e4

Please sign in to comment.