#57 first tests

This commit is contained in:
reyniersbram 2023-04-17 17:17:24 +02:00
parent 7c0e15cb9d
commit b7c6e887e3
2 changed files with 39 additions and 17 deletions

View file

@ -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)
}
}

View 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
)
}
}