parent
249106cf6a
commit
a4fb17e53c
1 changed files with 9 additions and 21 deletions
|
@ -1,14 +1,14 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
|
package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ProgramReminder
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.ProgramReminder
|
||||||
import org.apache.commons.codec.DecoderException
|
import org.apache.commons.codec.DecoderException
|
||||||
import org.apache.commons.codec.binary.Hex
|
import org.apache.commons.codec.binary.Hex
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ProgramTempBasalCommandTest {
|
class ProgramTempBasalCommandTest {
|
||||||
|
|
||||||
@Test @Throws(DecoderException::class) fun testExtraAlternateSegmentPulseTempBasal() {
|
@Test fun testExtraAlternateSegmentPulseTempBasal() {
|
||||||
val command = ProgramTempBasalCommand.Builder()
|
val command = ProgramTempBasalCommand.Builder()
|
||||||
.setUniqueId(37879809)
|
.setUniqueId(37879809)
|
||||||
.setNonce(1229869870)
|
.setNonce(1229869870)
|
||||||
|
@ -18,13 +18,10 @@ class ProgramTempBasalCommandTest {
|
||||||
.setProgramReminder(ProgramReminder(atStart = false, atEnd = true, atInterval = 0.toByte()))
|
.setProgramReminder(ProgramReminder(atStart = false, atEnd = true, atInterval = 0.toByte()))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
Assertions.assertArrayEquals(
|
assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200013C201A0E494E532E01011102384000321832160E400003F20036634403F20036634482A6").asList()).inOrder()
|
||||||
Hex.decodeHex("024200013C201A0E494E532E01011102384000321832160E400003F20036634403F20036634482A6"),
|
|
||||||
command.encoded
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(DecoderException::class) fun testZeroTempBasal() {
|
@Test fun testZeroTempBasal() {
|
||||||
val command = ProgramTempBasalCommand.Builder()
|
val command = ProgramTempBasalCommand.Builder()
|
||||||
.setUniqueId(37879809)
|
.setUniqueId(37879809)
|
||||||
.setNonce(1229869870)
|
.setNonce(1229869870)
|
||||||
|
@ -34,13 +31,10 @@ class ProgramTempBasalCommandTest {
|
||||||
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
|
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
Assertions.assertArrayEquals(
|
assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200011C201A0E494E532E0100820A384000009000160EC000000A6B49D200000A6B49D20001E3").asList()).inOrder()
|
||||||
Hex.decodeHex("024200011C201A0E494E532E0100820A384000009000160EC000000A6B49D200000A6B49D20001E3"),
|
|
||||||
command.encoded
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(DecoderException::class) fun testZeroTempBasalShort() {
|
@Test fun testZeroTempBasalShort() {
|
||||||
val command = ProgramTempBasalCommand.Builder()
|
val command = ProgramTempBasalCommand.Builder()
|
||||||
.setUniqueId(37879809)
|
.setUniqueId(37879809)
|
||||||
.setNonce(1229869870)
|
.setNonce(1229869870)
|
||||||
|
@ -50,13 +44,10 @@ class ProgramTempBasalCommandTest {
|
||||||
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
|
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
Assertions.assertArrayEquals(
|
assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200011C201A0E494E532E01007901384000000000160EC00000016B49D2000001EB49D200815B").asList()).inOrder()
|
||||||
Hex.decodeHex("024200011C201A0E494E532E01007901384000000000160EC00000016B49D2000001EB49D200815B"),
|
|
||||||
command.encoded
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(DecoderException::class) fun testZeroTempBasalVeryLong() {
|
@Test fun testZeroTempBasalVeryLong() {
|
||||||
val command = ProgramTempBasalCommand.Builder()
|
val command = ProgramTempBasalCommand.Builder()
|
||||||
.setUniqueId(37879809)
|
.setUniqueId(37879809)
|
||||||
.setNonce(1229869870)
|
.setNonce(1229869870)
|
||||||
|
@ -66,9 +57,6 @@ class ProgramTempBasalCommandTest {
|
||||||
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
|
.setProgramReminder(ProgramReminder(atStart = true, atEnd = true, atInterval = 0.toByte()))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
Assertions.assertArrayEquals(
|
assertThat(command.encoded).asList().containsExactlyElementsIn(Hex.decodeHex("024200011C221A10494E532E0100901838400000F0007000160EC00000186B49D20000186B49D2000132").asList()).inOrder()
|
||||||
Hex.decodeHex("024200011C221A10494E532E0100901838400000F0007000160EC00000186B49D20000186B49D2000132"),
|
|
||||||
command.encoded
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue