parent
65b5519361
commit
89366e54b8
1 changed files with 9 additions and 9 deletions
|
@ -2,9 +2,9 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio
|
||||||
|
|
||||||
import app.aaps.core.interfaces.profile.Profile
|
import app.aaps.core.interfaces.profile.Profile
|
||||||
import app.aaps.core.interfaces.profile.Profile.ProfileValue
|
import app.aaps.core.interfaces.profile.Profile.ProfileValue
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
||||||
import org.joda.time.Duration
|
import org.joda.time.Duration
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
@ -22,16 +22,16 @@ internal class AapsOmnipodErosManagerTest {
|
||||||
)
|
)
|
||||||
val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)
|
val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)
|
||||||
val entries = basalSchedule.entries
|
val entries = basalSchedule.entries
|
||||||
Assertions.assertEquals(3, entries.size)
|
assertThat(entries).hasSize(3)
|
||||||
val entry1 = entries[0]
|
val entry1 = entries[0]
|
||||||
Assertions.assertEquals(Duration.standardSeconds(0), entry1.startTime)
|
assertThat(entry1.startTime).isEqualTo(Duration.standardSeconds(0))
|
||||||
Assertions.assertEquals(0.5, entry1.rate, 0.000001)
|
assertThat(entry1.rate).isWithin(0.000001).of(0.5)
|
||||||
val entry2 = entries[1]
|
val entry2 = entries[1]
|
||||||
Assertions.assertEquals(Duration.standardSeconds(18000), entry2.startTime)
|
assertThat(entry2.startTime).isEqualTo(Duration.standardSeconds(18000))
|
||||||
Assertions.assertEquals(1.0, entry2.rate, 0.000001)
|
assertThat(entry2.rate).isWithin(0.000001).of(1.0)
|
||||||
val entry3 = entries[2]
|
val entry3 = entries[2]
|
||||||
Assertions.assertEquals(Duration.standardSeconds(50400), entry3.startTime)
|
assertThat(entry3.startTime).isEqualTo(Duration.standardSeconds(50400))
|
||||||
Assertions.assertEquals(3.05, entry3.rate, 0.000001)
|
assertThat(entry3.rate).isWithin(0.000001).of(3.05)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun invalidProfileNullProfile() {
|
@Test fun invalidProfileNullProfile() {
|
||||||
|
@ -90,6 +90,6 @@ internal class AapsOmnipodErosManagerTest {
|
||||||
)
|
)
|
||||||
val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)
|
val basalSchedule = AapsOmnipodErosManager.mapProfileToBasalSchedule(profile)
|
||||||
val basalScheduleEntry = basalSchedule.entries[0]
|
val basalScheduleEntry = basalSchedule.entries[0]
|
||||||
Assertions.assertEquals(0.05, basalScheduleEntry.rate, 0.000001)
|
assertThat(basalScheduleEntry.rate).isWithin(0.000001).of(0.05)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue