#57 first tests
This commit is contained in:
parent
7c0e15cb9d
commit
b7c6e887e3
2 changed files with 39 additions and 17 deletions
|
@ -1,17 +0,0 @@
|
|||
package be.ugent.sel.studeez
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
39
app/src/test/java/be/ugent/sel/studeez/TimeUnitTest.kt
Normal file
39
app/src/test/java/be/ugent/sel/studeez/TimeUnitTest.kt
Normal file
|
@ -0,0 +1,39 @@
|
|||
package be.ugent.sel.studeez
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.HoursMinutesSeconds
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.Time
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class TimeUnitTest {
|
||||
private val hours = 4
|
||||
private val minutes = 20
|
||||
private val seconds = 39
|
||||
private val time: Time = Time(seconds + minutes * 60 + hours * 60 * 60)
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
fun formatTime() {
|
||||
Assert.assertEquals(
|
||||
time.getAsHMS(),
|
||||
HoursMinutesSeconds(
|
||||
hours.toString().padStart(2, '0'),
|
||||
minutes.toString().padStart(2, '0'),
|
||||
seconds.toString().padStart(2, '0'),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getTime() {
|
||||
Assert.assertEquals(
|
||||
time.getTime(),
|
||||
seconds + minutes * 60 + hours * 60 * 60
|
||||
)
|
||||
}
|
||||
}
|
Reference in a new issue