parent
f83d8f0b56
commit
842a2d76de
1 changed files with 14 additions and 14 deletions
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.core.extensions
|
||||
|
||||
import app.aaps.shared.tests.TestBaseWithProfile
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.core.main.R
|
||||
import info.nightscout.database.entities.GlucoseValue
|
||||
import info.nightscout.interfaces.GlucoseUnit
|
||||
import info.nightscout.interfaces.iob.InMemoryGlucoseValue
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class GlucoseValueExtensionKtTest : TestBaseWithProfile() {
|
||||
|
@ -20,30 +20,30 @@ class GlucoseValueExtensionKtTest : TestBaseWithProfile() {
|
|||
|
||||
@Test
|
||||
fun inMemoryValueToUnits() {
|
||||
Assertions.assertEquals(100.0, inMemoryGlucoseValue.valueToUnits(GlucoseUnit.MGDL))
|
||||
Assertions.assertEquals(5.55, inMemoryGlucoseValue.valueToUnits(GlucoseUnit.MMOL), 0.01)
|
||||
assertThat(inMemoryGlucoseValue.valueToUnits(GlucoseUnit.MGDL)).isEqualTo(100.0)
|
||||
assertThat(inMemoryGlucoseValue.valueToUnits(GlucoseUnit.MMOL)).isWithin(0.01).of(5.55)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun directionToIcon() {
|
||||
Assertions.assertEquals(R.drawable.ic_flat, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_flat)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.NONE
|
||||
Assertions.assertEquals(R.drawable.ic_invalid, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_invalid)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.TRIPLE_DOWN
|
||||
Assertions.assertEquals(R.drawable.ic_invalid, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_invalid)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.TRIPLE_UP
|
||||
Assertions.assertEquals(R.drawable.ic_invalid, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_invalid)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.DOUBLE_DOWN
|
||||
Assertions.assertEquals(R.drawable.ic_doubledown, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_doubledown)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.SINGLE_DOWN
|
||||
Assertions.assertEquals(R.drawable.ic_singledown, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_singledown)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.FORTY_FIVE_DOWN
|
||||
Assertions.assertEquals(R.drawable.ic_fortyfivedown, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_fortyfivedown)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.FORTY_FIVE_UP
|
||||
Assertions.assertEquals(R.drawable.ic_fortyfiveup, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_fortyfiveup)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.SINGLE_UP
|
||||
Assertions.assertEquals(R.drawable.ic_singleup, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_singleup)
|
||||
glucoseValue.trendArrow = GlucoseValue.TrendArrow.DOUBLE_UP
|
||||
Assertions.assertEquals(R.drawable.ic_doubleup, glucoseValue.trendArrow.directionToIcon())
|
||||
assertThat(glucoseValue.trendArrow.directionToIcon()).isEqualTo(R.drawable.ic_doubleup)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue