Merge pull request #2875 from ryanhaining/assertthat_pump_smalldirs
Rewrites pump/ tests in directories with few tests with matchers
This commit is contained in:
commit
c9606d8aa4
9 changed files with 98 additions and 171 deletions
|
@ -12,11 +12,11 @@ import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.combo.ruffyscripter.RuffyScripter
|
import info.nightscout.pump.combo.ruffyscripter.RuffyScripter
|
||||||
import info.nightscout.pump.combo.ruffyscripter.history.Bolus
|
import info.nightscout.pump.combo.ruffyscripter.history.Bolus
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
@ -56,8 +56,8 @@ class ComboPluginTest : TestBase() {
|
||||||
comboPlugin.setPluginEnabled(PluginType.PUMP, true)
|
comboPlugin.setPluginEnabled(PluginType.PUMP, true)
|
||||||
comboPlugin.setValidBasalRateProfileSelectedOnPump(false)
|
comboPlugin.setValidBasalRateProfileSelectedOnPump(false)
|
||||||
val c = comboPlugin.isLoopInvocationAllowed(ConstraintObject(true, aapsLogger))
|
val c = comboPlugin.isLoopInvocationAllowed(ConstraintObject(true, aapsLogger))
|
||||||
Assertions.assertEquals("Combo: No valid basal rate read from pump", c.getReasons())
|
assertThat(c.getReasons()).isEqualTo("Combo: No valid basal rate read from pump")
|
||||||
Assertions.assertEquals(false, c.value())
|
assertThat(c.value()).isFalse()
|
||||||
comboPlugin.setPluginEnabled(PluginType.PUMP, false)
|
comboPlugin.setPluginEnabled(PluginType.PUMP, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,18 +66,16 @@ class ComboPluginTest : TestBase() {
|
||||||
val now = System.currentTimeMillis()
|
val now = System.currentTimeMillis()
|
||||||
val pumpTimestamp = now - now % 1000
|
val pumpTimestamp = now - now % 1000
|
||||||
// same timestamp, different bolus leads to different fake timestamp
|
// same timestamp, different bolus leads to different fake timestamp
|
||||||
Assertions.assertNotEquals(
|
assertThat(
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.1, true)),
|
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true))
|
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true))
|
||||||
)
|
).isNotEqualTo(comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.1, true)))
|
||||||
// different timestamp, same bolus leads to different fake timestamp
|
// different timestamp, same bolus leads to different fake timestamp
|
||||||
Assertions.assertNotEquals(
|
assertThat(
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true)),
|
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp + 60 * 1000, 0.3, true))
|
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp + 60 * 1000, 0.3, true))
|
||||||
)
|
).isNotEqualTo(comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true)))
|
||||||
// generated timestamp has second-precision
|
// generated timestamp has second-precision
|
||||||
val bolus = Bolus(pumpTimestamp, 0.2, true)
|
val bolus = Bolus(pumpTimestamp, 0.2, true)
|
||||||
val calculatedTimestamp = comboPlugin.generatePumpBolusId(bolus)
|
val calculatedTimestamp = comboPlugin.generatePumpBolusId(bolus)
|
||||||
Assertions.assertEquals(calculatedTimestamp, calculatedTimestamp - calculatedTimestamp % 1000)
|
assertThat(calculatedTimestamp - calculatedTimestamp % 1000).isEqualTo(calculatedTimestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
||||||
|
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
||||||
import info.nightscout.pump.common.utils.ByteUtil
|
import info.nightscout.pump.common.utils.ByteUtil
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
@ -162,7 +162,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
|
||||||
"5A 0F 20 F4 0C 03 15 19 11 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 11 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 01 12 12 00 25 DE 2D 43 15 01 50 50 00 26 EA 2D 43 15 01 4B 4B 00 2C C9 34 43 15 62 00 2F CB 17 03 15 01 33 33 00 16 DE 37 43 15 07 00 00 07 FE 23 95 6D 23 95 0A 08 00 2B 00 00 00 00 07 FE 03 8E 2C 04 70 38 00 00 04 70 38 00 00 00 00 00 00 04 70 64 06 00 00 00 06 08 00 2B 00 00 00 2C A0 2F E3 01 04 15 33 00 2F E7 04 44 15 00 16 03 2F E7 04 44 15 33 28 3B C2 06 44 15 00 16 01 3B C2 06 44 15 08 08 17 DB 0B 44 15 00 26 00 06 26 00 0C 26 00 12 28 00 18 26 00 1E 26 00 24 24 00 2A 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 17 DB 0B 44 15 00 26 00 02 26 00 04 26 00 06 24 00 08 24 00 0A 24 00 0C 26 00 0E 26 00 10 26 00 12 28 00 14 28 00 16 28 00 18 26 00 1A 26 00 1C 26 00 1E 26 00 20 26 00 22 26 00 24 24 00 26 24 00 28 24 00 2A 26 00 2C 26 00 2E 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 45 45 00 28 E9 2B 44 15 19 00 00 C1 0D 04 15 1A 00 15 C3 0D 04 15 1A 01 33 C3 0D 04 15 01 28 28 00 07 CC 2E 44 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 2D",
|
"5A 0F 20 F4 0C 03 15 19 11 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 11 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 01 12 12 00 25 DE 2D 43 15 01 50 50 00 26 EA 2D 43 15 01 4B 4B 00 2C C9 34 43 15 62 00 2F CB 17 03 15 01 33 33 00 16 DE 37 43 15 07 00 00 07 FE 23 95 6D 23 95 0A 08 00 2B 00 00 00 00 07 FE 03 8E 2C 04 70 38 00 00 04 70 38 00 00 00 00 00 00 04 70 64 06 00 00 00 06 08 00 2B 00 00 00 2C A0 2F E3 01 04 15 33 00 2F E7 04 44 15 00 16 03 2F E7 04 44 15 33 28 3B C2 06 44 15 00 16 01 3B C2 06 44 15 08 08 17 DB 0B 44 15 00 26 00 06 26 00 0C 26 00 12 28 00 18 26 00 1E 26 00 24 24 00 2A 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 17 DB 0B 44 15 00 26 00 02 26 00 04 26 00 06 24 00 08 24 00 0A 24 00 0C 26 00 0E 26 00 10 26 00 12 28 00 14 28 00 16 28 00 18 26 00 1A 26 00 1C 26 00 1E 26 00 20 26 00 22 26 00 24 24 00 26 24 00 28 24 00 2A 26 00 2C 26 00 2E 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 45 45 00 28 E9 2B 44 15 19 00 00 C1 0D 04 15 1A 00 15 C3 0D 04 15 1A 01 33 C3 0D 04 15 01 28 28 00 07 CC 2E 44 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 2D",
|
||||||
MedtronicDeviceType.Medtronic_522_722
|
MedtronicDeviceType.Medtronic_522_722
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(20, pumpHistoryEntries.size.toLong())
|
assertThat(pumpHistoryEntries).hasSize(20)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(Exception::class) fun historyProblem_423_duzy78() {
|
@Test @Throws(Exception::class) fun historyProblem_423_duzy78() {
|
||||||
|
@ -170,7 +170,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
|
||||||
"16 00 08 D0 0E 51 15 33 60 0A D0 0E 51 15 00 16 01 0A D0 0E 51 15 33 00 07 DF 0E 51 15 00 16 00 07 DF 0E 51 15 33 6C 09 DF 0E 51 15 00 16 01 09 DF 0E 51 15 33 00 25 ED 0E 51 15 00 16 00 25 ED 0E 51 15 33 2C 27 ED 0E 51 15 00 16 01 27 ED 0E 51 15 33 00 07 F4 0E 51 15 00 16 00 07 F4 0E 51 15 33 00 09 F4 0E 51 15 00 16 01 09 F4 0E 51 15 33 2C 25 D5 0F 51 15 00 16 01 25 D5 0F 51 15 01 3C 3C 00 30 D5 4F 51 15 33 2C 25 F7 0F 51 15 00 16 01 25 F7 0F 51 15 33 00 07 C6 10 51 15 00 16 00 07 C6 10 51 15 33 30 09 C6 10 51 15 00 16 01 09 C6 10 51 15 33 30 25 E8 10 51 15 00 16 01 25 E8 10 51 15 33 30 24 CF 11 51 15 00 16 01 24 CF 11 51 15 33 00 23 E4 11 51 15 00 16 00 23 E4 11 51 15 33 3C 25 E4 11 51 15 00 16 01 25 E4 11 51 15 33 00 23 E8 11 51 15 00 16 00 23 E8 11 51 15 33 4A 25 E8 11 51 15 00 16 01 25 E8 11 51 15 33 00 19 EE 11 51 15 00 16 00 19 EE 11 51 15 33 30 1B EE 11 51 15 00 16 01 1B EE 11 51 15 33 00 23 F2 11 51 15 00 16 00 23 F2 11 51 15 33 3E 25 F2 11 51 15 00 16 01 25 F2 11 51 15 33 00 24 C0 12 51 15 00 16 00 24 C0 12 51 15 33 5E 25 C0 12 51 15 00 16 01 25 C0 12 51 15 33 00 23 CF 12 51 15 00 16 00 23 CF 12 51 15 33 64 25 CF 12 51 15 00 16 01 25 CF 12 51 15 33 00 23 D9 12 51 15 00 16 00 23 D9 12 51 15 33 6A 25 D9 12 51 15 00 16 01 25 D9 12 51 15 33 00 23 E9 12 51 15 00 16 00 23 E9 12 51 15 33 30 25 E9 12 51 15 00 16 01 25 E9 12 51 15 01 16 16 00 10 C2 53 51 15 33 30 24 CF 13 51 15 00 16 01 24 CF 13 51 15 33 30 04 EE 13 51 15 00 16 01 04 EE 13 51 15 01 14 14 00 3B F0 53 51 15 33 00 22 C0 14 51 15 00 16 00 22 C0 14 51 15 33 22 24 C0 14 51 15 00 16 01 24 C0 14 51 15 33 22 03 DF 14 51 15 00 16 01 03 DF 14 51 15 1E 00 37 E1 14 11 15 1F 00 01 EE 14 11 15 33 22 03 C6 15 51 15 00 16 01 03 C6 15 51 15 33 00 20 D9 15 51 15 00 16 00 20 D9 15 51 15 33 34 22 D9 15 51 15 00 16 01 22 D9 15 51 15 39 14 0E DF 35 71 15 83 92 40 01 0B 0B 00 37 E0 55 51 15 33 00 21 E3 15 51 15 00 16 00 21 E3 15 51 15 33 22 22 E3 15 51 15 00 16 01 22 E3 15 51 15 33 00 21 E8 15 51 15 00 16 00 21 E8 15 51 15 33 30 23 E8 15 51 15 00 16 01 23 E8 15 51 15 33 00 20 ED 15 51 15 00 16 00 20 ED 15 51 15 33 22 22 ED 15 51 15 00 16 01 22 ED 15 51 15 33 00 03 F8 15 51 15 00 16 00 03 F8 15 51 15 33 32 05 F8 15 51 15 00 16 01 05 F8 15 51 15 33 00 01 CB 16 51 15 00 16 00 01 CB 16 51 15 33 20 03 CB 16 51 15 00 16 01 03 CB 16 51 15 33 2A 20 ED 16 51 15 00 16 01 20 ED 16 51 15 33 00 02 F8 16 51 15 00 16 00 02 F8 16 51 15 33 2C 04 F8 16 51 15 00 16 01 04 F8 16 51 15 33 00 1F CA 17 51 15 00 16 00 1F CA 17 51 15 33 34 21 CA 17 51 15 00 16 01 21 CA 17 51 15 33 00 1F D4 17 51 15 00 16 00 1F D4 17 51 15 33 38 21 D4 17 51 15 00 16 01 21 D4 17 51 15 33 00 15 EE 17 51 15 00 16 00 15 EE 17 51 15 33 42 17 EE 17 51 15 00 16 01 17 EE 17 51 15 07 00 00 08 0A 31 95 6C 31 95 05 00 A1 A1 A1 01 00 00 08 0A 04 8E 39 03 7C 2B 00 00 03 7C 2B 00 00 00 00 00 00 03 7C 64 07 00 00 00 07 33 00 05 C1 00 52 15 00 16 00 05 C1 00 52 15 33 50 07 C1 00 52 15 00 16 01 07 C1 00 52 15 33 00 01 CB 00 52 15 00 16 00 01 CB 00 52 15 33 26 03 CB 00 52 15 00 16 01 03 CB 00 52 15 33 00 1E DE 00 52 15 00 00 00 8F 0E",
|
"16 00 08 D0 0E 51 15 33 60 0A D0 0E 51 15 00 16 01 0A D0 0E 51 15 33 00 07 DF 0E 51 15 00 16 00 07 DF 0E 51 15 33 6C 09 DF 0E 51 15 00 16 01 09 DF 0E 51 15 33 00 25 ED 0E 51 15 00 16 00 25 ED 0E 51 15 33 2C 27 ED 0E 51 15 00 16 01 27 ED 0E 51 15 33 00 07 F4 0E 51 15 00 16 00 07 F4 0E 51 15 33 00 09 F4 0E 51 15 00 16 01 09 F4 0E 51 15 33 2C 25 D5 0F 51 15 00 16 01 25 D5 0F 51 15 01 3C 3C 00 30 D5 4F 51 15 33 2C 25 F7 0F 51 15 00 16 01 25 F7 0F 51 15 33 00 07 C6 10 51 15 00 16 00 07 C6 10 51 15 33 30 09 C6 10 51 15 00 16 01 09 C6 10 51 15 33 30 25 E8 10 51 15 00 16 01 25 E8 10 51 15 33 30 24 CF 11 51 15 00 16 01 24 CF 11 51 15 33 00 23 E4 11 51 15 00 16 00 23 E4 11 51 15 33 3C 25 E4 11 51 15 00 16 01 25 E4 11 51 15 33 00 23 E8 11 51 15 00 16 00 23 E8 11 51 15 33 4A 25 E8 11 51 15 00 16 01 25 E8 11 51 15 33 00 19 EE 11 51 15 00 16 00 19 EE 11 51 15 33 30 1B EE 11 51 15 00 16 01 1B EE 11 51 15 33 00 23 F2 11 51 15 00 16 00 23 F2 11 51 15 33 3E 25 F2 11 51 15 00 16 01 25 F2 11 51 15 33 00 24 C0 12 51 15 00 16 00 24 C0 12 51 15 33 5E 25 C0 12 51 15 00 16 01 25 C0 12 51 15 33 00 23 CF 12 51 15 00 16 00 23 CF 12 51 15 33 64 25 CF 12 51 15 00 16 01 25 CF 12 51 15 33 00 23 D9 12 51 15 00 16 00 23 D9 12 51 15 33 6A 25 D9 12 51 15 00 16 01 25 D9 12 51 15 33 00 23 E9 12 51 15 00 16 00 23 E9 12 51 15 33 30 25 E9 12 51 15 00 16 01 25 E9 12 51 15 01 16 16 00 10 C2 53 51 15 33 30 24 CF 13 51 15 00 16 01 24 CF 13 51 15 33 30 04 EE 13 51 15 00 16 01 04 EE 13 51 15 01 14 14 00 3B F0 53 51 15 33 00 22 C0 14 51 15 00 16 00 22 C0 14 51 15 33 22 24 C0 14 51 15 00 16 01 24 C0 14 51 15 33 22 03 DF 14 51 15 00 16 01 03 DF 14 51 15 1E 00 37 E1 14 11 15 1F 00 01 EE 14 11 15 33 22 03 C6 15 51 15 00 16 01 03 C6 15 51 15 33 00 20 D9 15 51 15 00 16 00 20 D9 15 51 15 33 34 22 D9 15 51 15 00 16 01 22 D9 15 51 15 39 14 0E DF 35 71 15 83 92 40 01 0B 0B 00 37 E0 55 51 15 33 00 21 E3 15 51 15 00 16 00 21 E3 15 51 15 33 22 22 E3 15 51 15 00 16 01 22 E3 15 51 15 33 00 21 E8 15 51 15 00 16 00 21 E8 15 51 15 33 30 23 E8 15 51 15 00 16 01 23 E8 15 51 15 33 00 20 ED 15 51 15 00 16 00 20 ED 15 51 15 33 22 22 ED 15 51 15 00 16 01 22 ED 15 51 15 33 00 03 F8 15 51 15 00 16 00 03 F8 15 51 15 33 32 05 F8 15 51 15 00 16 01 05 F8 15 51 15 33 00 01 CB 16 51 15 00 16 00 01 CB 16 51 15 33 20 03 CB 16 51 15 00 16 01 03 CB 16 51 15 33 2A 20 ED 16 51 15 00 16 01 20 ED 16 51 15 33 00 02 F8 16 51 15 00 16 00 02 F8 16 51 15 33 2C 04 F8 16 51 15 00 16 01 04 F8 16 51 15 33 00 1F CA 17 51 15 00 16 00 1F CA 17 51 15 33 34 21 CA 17 51 15 00 16 01 21 CA 17 51 15 33 00 1F D4 17 51 15 00 16 00 1F D4 17 51 15 33 38 21 D4 17 51 15 00 16 01 21 D4 17 51 15 33 00 15 EE 17 51 15 00 16 00 15 EE 17 51 15 33 42 17 EE 17 51 15 00 16 01 17 EE 17 51 15 07 00 00 08 0A 31 95 6C 31 95 05 00 A1 A1 A1 01 00 00 08 0A 04 8E 39 03 7C 2B 00 00 03 7C 2B 00 00 00 00 00 00 03 7C 64 07 00 00 00 07 33 00 05 C1 00 52 15 00 16 00 05 C1 00 52 15 33 50 07 C1 00 52 15 00 16 01 07 C1 00 52 15 33 00 01 CB 00 52 15 00 16 00 01 CB 00 52 15 33 26 03 CB 00 52 15 00 16 01 03 CB 00 52 15 33 00 1E DE 00 52 15 00 00 00 8F 0E",
|
||||||
MedtronicDeviceType.Medtronic_515_715
|
MedtronicDeviceType.Medtronic_515_715
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(131, pumpHistoryEntries.size.toLong())
|
assertThat(pumpHistoryEntries).hasSize(131)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(Exception::class) fun historyProblem_476_OpossumGit() {
|
@Test @Throws(Exception::class) fun historyProblem_476_OpossumGit() {
|
||||||
|
@ -178,7 +178,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
|
||||||
"08 07 50 05 0D 4D 15 00 18 00 08 14 00 0E 10 00 14 08 00 1E 12 00 26 16 00 2B 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 50 05 0D 4D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04 04 00 44 09 4D 4D 15 33 06 57 15 0D 4D 15 00 16 01 57 15 0D 4D 15 33 00 77 15 0D 4D 15 00 16 00 77 15 0D 4D 15 33 00 5D 16 0D 4D 15 00 16 04 5D 16 0D 4D 15 33 00 61 1A 0D 4D 15 00 16 00 61 1A 0D 4D 15 5D 00 5E 31 0D 0D 15 1A 00 6E 31 0D 0D 15 06 03 04 D2 6E 31 6D 0D 15 0C 03 11 40 00 01 05 64 01 13 40 00 01 05 17 00 0A 41 00 01 05 18 00 40 39 15 0D 15 21 00 53 04 16 0D 15 03 00 00 00 58 57 09 36 0D 15 5D 01 78 0A 16 0D 15 64 01 78 0A 16 8D 15 2C 68 78 0A 16 8D 15 24 3C 78 0A 16 8D 15 63 02 78 0A 16 8D 15 1B 12 78 0A 16 8D 15 65 61 78 0A 16 8D 15 61 00 78 0A 16 8D 15 32 0E 78 0A 16 8D 15 66 00 78 0A 16 8D 15 3C 01 78 0A 16 8D 15 3D 88 32 93 00 00 00 3E 00 00 00 00 00 00 26 01 78 0A 16 8D 15 27 01 B2 08 00 00 00 28 00 00 00 00 00 00 60 00 78 0A 16 4D 15 23 00 78 0A 16 8D 15 5E 01 78 0A 16 8D 15 2D 01 78 0A 16 8D 15 5A 0F 78 0A 16 8D 15 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 62 00 78 0A 16 8D 15 5F 51 78 0A 16 8D 15 4F 00 78 0A 16 8D 15 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 08 18 78 0A 16 8D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D6 06",
|
"08 07 50 05 0D 4D 15 00 18 00 08 14 00 0E 10 00 14 08 00 1E 12 00 26 16 00 2B 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 50 05 0D 4D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04 04 00 44 09 4D 4D 15 33 06 57 15 0D 4D 15 00 16 01 57 15 0D 4D 15 33 00 77 15 0D 4D 15 00 16 00 77 15 0D 4D 15 33 00 5D 16 0D 4D 15 00 16 04 5D 16 0D 4D 15 33 00 61 1A 0D 4D 15 00 16 00 61 1A 0D 4D 15 5D 00 5E 31 0D 0D 15 1A 00 6E 31 0D 0D 15 06 03 04 D2 6E 31 6D 0D 15 0C 03 11 40 00 01 05 64 01 13 40 00 01 05 17 00 0A 41 00 01 05 18 00 40 39 15 0D 15 21 00 53 04 16 0D 15 03 00 00 00 58 57 09 36 0D 15 5D 01 78 0A 16 0D 15 64 01 78 0A 16 8D 15 2C 68 78 0A 16 8D 15 24 3C 78 0A 16 8D 15 63 02 78 0A 16 8D 15 1B 12 78 0A 16 8D 15 65 61 78 0A 16 8D 15 61 00 78 0A 16 8D 15 32 0E 78 0A 16 8D 15 66 00 78 0A 16 8D 15 3C 01 78 0A 16 8D 15 3D 88 32 93 00 00 00 3E 00 00 00 00 00 00 26 01 78 0A 16 8D 15 27 01 B2 08 00 00 00 28 00 00 00 00 00 00 60 00 78 0A 16 4D 15 23 00 78 0A 16 8D 15 5E 01 78 0A 16 8D 15 2D 01 78 0A 16 8D 15 5A 0F 78 0A 16 8D 15 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 62 00 78 0A 16 8D 15 5F 51 78 0A 16 8D 15 4F 00 78 0A 16 8D 15 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 08 18 78 0A 16 8D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D6 06",
|
||||||
MedtronicDeviceType.Medtronic_522_722
|
MedtronicDeviceType.Medtronic_522_722
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(41, pumpHistoryEntries.size.toLong())
|
assertThat(pumpHistoryEntries).hasSize(41)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,12 +10,12 @@ import org.junit.jupiter.api.Test
|
||||||
*/
|
*/
|
||||||
class PumpHistoryEntryUTest : MedtronicTestBase() {
|
class PumpHistoryEntryUTest : MedtronicTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun checkIsAfter() {
|
fun checkIsAfter() {
|
||||||
val dateObject = 20191010000000L
|
val dateObject = 20191010000000L
|
||||||
val queryObject = 20191009000000L
|
val queryObject = 20191009000000L
|
||||||
val phe = PumpHistoryEntry()
|
val phe = PumpHistoryEntry()
|
||||||
phe.atechDateTime = dateObject
|
phe.atechDateTime = dateObject
|
||||||
Assertions.assertTrue(phe.isAfter(queryObject))
|
assertThat(phe.isAfter(queryObject)).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import app.aaps.core.interfaces.utils.DecimalFormatter
|
||||||
import app.aaps.implementation.utils.DecimalFormatterImpl
|
import app.aaps.implementation.utils.DecimalFormatterImpl
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
import app.aaps.shared.tests.rx.TestAapsSchedulers
|
import app.aaps.shared.tests.rx.TestAapsSchedulers
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil
|
||||||
|
@ -19,7 +20,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodE
|
||||||
import info.nightscout.pump.common.defs.TempBasalPair
|
import info.nightscout.pump.common.defs.TempBasalPair
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import org.joda.time.tz.UTCProvider
|
import org.joda.time.tz.UTCProvider
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
|
@ -100,17 +100,17 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
val result5 =
|
val result5 =
|
||||||
plugin.setTempBasalPercent(-50, 60, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
plugin.setTempBasalPercent(-50, 60, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
||||||
// Then return correct values
|
// Then return correct values
|
||||||
Assertions.assertEquals(result1.absolute, 0.4, 0.01)
|
assertThat(result1.absolute).isWithin(0.01).of(0.4)
|
||||||
Assertions.assertEquals(result1.duration, 30)
|
assertThat(result1.duration).isEqualTo(30)
|
||||||
Assertions.assertEquals(result2.absolute, 25.0, 0.01)
|
assertThat(result2.absolute).isWithin(0.01).of(25.0)
|
||||||
Assertions.assertEquals(result2.duration, 30000)
|
assertThat(result2.duration).isEqualTo(30000)
|
||||||
Assertions.assertEquals(result3.absolute, 0.0, 0.01)
|
assertThat(result3.absolute).isWithin(0.01).of(0.0)
|
||||||
Assertions.assertEquals(result3.duration, 30)
|
assertThat(result3.duration).isEqualTo(30)
|
||||||
Assertions.assertEquals(result4.absolute, -1.0, 0.01)
|
assertThat(result4.absolute).isWithin(0.01).of(-1.0)
|
||||||
Assertions.assertEquals(result4.duration, -1)
|
assertThat(result4.duration).isEqualTo(-1)
|
||||||
// this is validated downstream, see TempBasalExtraCommand
|
// this is validated downstream, see TempBasalExtraCommand
|
||||||
Assertions.assertEquals(result5.absolute, -0.25, 0.01)
|
assertThat(result5.absolute).isWithin(0.01).of(-0.25)
|
||||||
Assertions.assertEquals(result5.duration, 60)
|
assertThat(result5.duration).isEqualTo(60)
|
||||||
|
|
||||||
// Given zero basal
|
// Given zero basal
|
||||||
`when`(profile.getBasal()).thenReturn(0.0)
|
`when`(profile.getBasal()).thenReturn(0.0)
|
||||||
|
@ -120,10 +120,10 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
result2 =
|
result2 =
|
||||||
plugin.setTempBasalPercent(0, 0, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
plugin.setTempBasalPercent(0, 0, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
||||||
// Then return zero values
|
// Then return zero values
|
||||||
Assertions.assertEquals(result1.absolute, 0.0, 0.01)
|
assertThat(result1.absolute).isWithin(0.01).of(0.0)
|
||||||
Assertions.assertEquals(result1.duration, 90)
|
assertThat(result1.duration).isEqualTo(90)
|
||||||
Assertions.assertEquals(result2.absolute, -1.0, 0.01)
|
assertThat(result2.absolute).isWithin(0.01).of(-1.0)
|
||||||
Assertions.assertEquals(result2.duration, -1)
|
assertThat(result2.duration).isEqualTo(-1)
|
||||||
|
|
||||||
// Given unhealthy basal
|
// Given unhealthy basal
|
||||||
`when`(profile.getBasal()).thenReturn(500.0)
|
`when`(profile.getBasal()).thenReturn(500.0)
|
||||||
|
@ -131,12 +131,10 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
result1 =
|
result1 =
|
||||||
plugin.setTempBasalPercent(80, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
plugin.setTempBasalPercent(80, 30, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
||||||
// Then return sane values
|
// Then return sane values
|
||||||
Assertions.assertEquals(
|
assertThat(result1.absolute).isWithin(0.01).of(
|
||||||
result1.absolute,
|
PumpType.OMNIPOD_EROS.determineCorrectBasalSize(500.0 * 0.8)
|
||||||
PumpType.OMNIPOD_EROS.determineCorrectBasalSize(500.0 * 0.8),
|
|
||||||
0.01
|
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(result1.duration, 30)
|
assertThat(result1.duration).isEqualTo(30)
|
||||||
|
|
||||||
// Given weird basal
|
// Given weird basal
|
||||||
`when`(profile.getBasal()).thenReturn(1.234567)
|
`when`(profile.getBasal()).thenReturn(1.234567)
|
||||||
|
@ -144,8 +142,8 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
result1 =
|
result1 =
|
||||||
plugin.setTempBasalPercent(280, 600, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
plugin.setTempBasalPercent(280, 600, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
||||||
// Then return sane values
|
// Then return sane values
|
||||||
Assertions.assertEquals(result1.absolute, 3.4567876, 0.01)
|
assertThat(result1.absolute).isWithin(0.01).of(3.4567876)
|
||||||
Assertions.assertEquals(result1.duration, 600)
|
assertThat(result1.duration).isEqualTo(600)
|
||||||
|
|
||||||
// Given negative basal
|
// Given negative basal
|
||||||
`when`(profile.getBasal()).thenReturn(-1.234567)
|
`when`(profile.getBasal()).thenReturn(-1.234567)
|
||||||
|
@ -153,7 +151,7 @@ class OmnipodErosPumpPluginTest : TestBase() {
|
||||||
result1 =
|
result1 =
|
||||||
plugin.setTempBasalPercent(280, 510, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
plugin.setTempBasalPercent(280, 510, profile, false, PumpSync.TemporaryBasalType.NORMAL)
|
||||||
// Then return negative value (this is validated further downstream, see TempBasalExtraCommand)
|
// Then return negative value (this is validated further downstream, see TempBasalExtraCommand)
|
||||||
Assertions.assertEquals(result1.absolute, -3.4567876, 0.01)
|
assertThat(result1.absolute).isWithin(0.01).of(-3.4567876)
|
||||||
Assertions.assertEquals(result1.duration, 510)
|
assertThat(result1.duration).isEqualTo(510)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,35 +3,35 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.communicatio
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodInfoType
|
||||||
import info.nightscout.pump.common.utils.ByteUtil
|
import info.nightscout.pump.common.utils.ByteUtil
|
||||||
import org.junit.jupiter.api.Assertions
|
import kotlin.test.assertIsNot
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
internal class PodInfoResponseTest {
|
internal class PodInfoResponseTest {
|
||||||
|
|
||||||
@Test fun testRawData() {
|
@Test fun testRawData() {
|
||||||
val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")
|
val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")!!
|
||||||
val podInfoResponse = PodInfoResponse(encodedData)
|
val podInfoResponse = PodInfoResponse(encodedData)
|
||||||
Assertions.assertArrayEquals(encodedData, podInfoResponse.rawData)
|
assertThat(podInfoResponse.rawData.asList()).containsExactlyElementsIn(encodedData.asIterable()).inOrder()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun testRawDataWithLongerMessage() {
|
@Test fun testRawDataWithLongerMessage() {
|
||||||
val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d01")
|
val encodedData = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d01")!!
|
||||||
val expected = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")
|
val expected = ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d")!!
|
||||||
val podInfoResponse = PodInfoResponse(encodedData)
|
val podInfoResponse = PodInfoResponse(encodedData)
|
||||||
Assertions.assertArrayEquals(expected, podInfoResponse.rawData)
|
assertThat(podInfoResponse.rawData.asList()).containsExactlyElementsIn(expected.asIterable()).inOrder()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun testMessageDecoding() {
|
@Test fun testMessageDecoding() {
|
||||||
val podInfoResponse = PodInfoResponse(ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d"))
|
val podInfoResponse = PodInfoResponse(ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d"))
|
||||||
Assertions.assertEquals(PodInfoType.DETAILED_STATUS, podInfoResponse.subType)
|
assertThat(podInfoResponse.subType).isEqualTo(PodInfoType.DETAILED_STATUS)
|
||||||
val podInfo = podInfoResponse.podInfo as PodInfoDetailedStatus
|
val podInfo = podInfoResponse.podInfo as PodInfoDetailedStatus
|
||||||
Assertions.assertFalse(podInfo.isFaultAccessingTables)
|
assertThat(podInfo.isFaultAccessingTables).isFalse()
|
||||||
Assertions.assertEquals(0x01, podInfo.errorEventInfo.internalVariable.toInt())
|
assertThat(podInfo.errorEventInfo.internalVariable.toInt()).isEqualTo(0x01)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun testInvalidPodInfoTypeMessageDecoding() {
|
@Test fun testInvalidPodInfoTypeMessageDecoding() {
|
||||||
val podInfoResponse = PodInfoResponse(ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d"))
|
val podInfoResponse = PodInfoResponse(ByteUtil.fromHexString("0216020d0000000000ab6a038403ff03860000285708030d"))
|
||||||
Assertions.assertEquals(PodInfoType.DETAILED_STATUS, podInfoResponse.subType)
|
assertThat(podInfoResponse.subType).isEqualTo(PodInfoType.DETAILED_STATUS)
|
||||||
assertThat(podInfoResponse.podInfo).isNotInstanceOf(PodInfoActiveAlerts::class.java)
|
assertIsNot<PodInfoActiveAlerts>(podInfoResponse.podInfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.manager
|
||||||
|
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FirmwareVersion
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.FirmwareVersion
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
@ -9,7 +10,6 @@ import org.joda.time.DateTimeUtils
|
||||||
import org.joda.time.DateTimeZone
|
import org.joda.time.DateTimeZone
|
||||||
import org.joda.time.Duration
|
import org.joda.time.Duration
|
||||||
import org.junit.jupiter.api.AfterEach
|
import org.junit.jupiter.api.AfterEach
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
|
||||||
|
@ -28,11 +28,10 @@ class AapsErosPodStateManagerTest : TestBase() {
|
||||||
0, 0, FirmwareVersion(1, 1, 1),
|
0, 0, FirmwareVersion(1, 1, 1),
|
||||||
FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS
|
FirmwareVersion(2, 2, 2), timeZone, PodProgressStatus.ABOVE_FIFTY_UNITS
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(now, podStateManager.time)
|
assertThat(podStateManager.time).isEqualTo(now)
|
||||||
Assertions.assertEquals(
|
assertThat(podStateManager.scheduleOffset).isEqualTo(
|
||||||
Duration.standardHours(1)
|
Duration.standardHours(1)
|
||||||
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
|
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
|
||||||
podStateManager.scheduleOffset
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,11 +51,10 @@ class AapsErosPodStateManagerTest : TestBase() {
|
||||||
|
|
||||||
// The system time zone has been updated, but the pod session state's time zone hasn't
|
// The system time zone has been updated, but the pod session state's time zone hasn't
|
||||||
// So the pods time should not have been changed
|
// So the pods time should not have been changed
|
||||||
Assertions.assertEquals(now, podStateManager.time)
|
assertThat(podStateManager.time).isEqualTo(now)
|
||||||
Assertions.assertEquals(
|
assertThat(podStateManager.scheduleOffset).isEqualTo(
|
||||||
Duration.standardHours(1)
|
Duration.standardHours(1)
|
||||||
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
|
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
|
||||||
podStateManager.scheduleOffset
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,15 +75,14 @@ class AapsErosPodStateManagerTest : TestBase() {
|
||||||
|
|
||||||
// Both the system time zone have been updated
|
// Both the system time zone have been updated
|
||||||
// So the pods time should have been changed (to +2 hours)
|
// So the pods time should have been changed (to +2 hours)
|
||||||
Assertions.assertEquals(now.withZone(newTimeZone), podStateManager.time)
|
assertThat(podStateManager.time).isEqualTo(now.withZone(newTimeZone))
|
||||||
Assertions.assertEquals(
|
assertThat(podStateManager.scheduleOffset).isEqualTo(
|
||||||
Duration.standardHours(3)
|
Duration.standardHours(3)
|
||||||
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3))),
|
.plus(Duration.standardMinutes(2).plus(Duration.standardSeconds(3)))
|
||||||
podStateManager.scheduleOffset
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach fun tearDown() {
|
@AfterEach fun tearDown() {
|
||||||
DateTimeUtils.setCurrentMillisSystem()
|
DateTimeUtils.setCurrentMillisSystem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,100 +1,34 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble
|
package info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble
|
||||||
|
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.ble.defs.RileyLinkFirmwareVersion
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection") class RFSpyTest : TestBase() {
|
@Suppress("SpellCheckingInspection") class RFSpyTest : TestBase() {
|
||||||
|
|
||||||
@Test fun testGetFirmwareVersion() {
|
@Test fun testGetFirmwareVersion() {
|
||||||
Assertions.assertEquals(
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0")).isEqualTo(RileyLinkFirmwareVersion.Version_1_0)
|
||||||
RileyLinkFirmwareVersion.Version_1_0,
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1")).isEqualTo(RileyLinkFirmwareVersion.Version_1_x)
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.0")
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13")).isEqualTo(RileyLinkFirmwareVersion.Version_1_x)
|
||||||
)
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0")).isEqualTo(RileyLinkFirmwareVersion.Version_2_0)
|
||||||
Assertions.assertEquals(
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1")).isEqualTo(RileyLinkFirmwareVersion.Version_2_0)
|
||||||
RileyLinkFirmwareVersion.Version_1_x,
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2)
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1")
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2)
|
||||||
)
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17")).isEqualTo(RileyLinkFirmwareVersion.Version_2_2)
|
||||||
Assertions.assertEquals(
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x)
|
||||||
RileyLinkFirmwareVersion.Version_1_x,
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x)
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 1.1.13")
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17")).isEqualTo(RileyLinkFirmwareVersion.Version_2_x)
|
||||||
)
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
|
||||||
Assertions.assertEquals(
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
|
||||||
RileyLinkFirmwareVersion.Version_2_0,
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0")
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13")).isEqualTo(RileyLinkFirmwareVersion.Version_3_x)
|
||||||
)
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
|
||||||
Assertions.assertEquals(
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
|
||||||
RileyLinkFirmwareVersion.Version_2_0,
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.0.1")
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7")).isEqualTo(RileyLinkFirmwareVersion.Version_4_x)
|
||||||
)
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion)
|
||||||
Assertions.assertEquals(
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion)
|
||||||
RileyLinkFirmwareVersion.Version_2_2,
|
assertThat(RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5")).isEqualTo(RileyLinkFirmwareVersion.UnknownVersion)
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_2_2,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.16")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_2_2,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.2.17")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_2_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_2_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.0")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_2_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 2.3.17")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_3_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_3_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.0.1")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_3_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_3_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 3.1.13")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_4_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_4_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.0.4")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_4_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.3")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.Version_4_x,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 4.5.7")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.UnknownVersion,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.UnknownVersion,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.0.0")
|
|
||||||
)
|
|
||||||
Assertions.assertEquals(
|
|
||||||
RileyLinkFirmwareVersion.UnknownVersion,
|
|
||||||
RFSpy.getFirmwareVersion(aapsLogger, "", "subg_rfspy 5.5.5")
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.core.interfaces.utils.fabric.FabricPrivacy
|
import app.aaps.core.interfaces.utils.fabric.FabricPrivacy
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
@ -49,7 +49,7 @@ class VirtualPumpPluginUTest : TestBase() {
|
||||||
fun refreshConfiguration() {
|
fun refreshConfiguration() {
|
||||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||||
virtualPumpPlugin.refreshConfiguration()
|
virtualPumpPlugin.refreshConfiguration()
|
||||||
Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
assertThat(virtualPumpPlugin.pumpType).isEqualTo(PumpType.ACCU_CHEK_COMBO)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -58,6 +58,6 @@ class VirtualPumpPluginUTest : TestBase() {
|
||||||
virtualPumpPlugin.refreshConfiguration()
|
virtualPumpPlugin.refreshConfiguration()
|
||||||
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
`when`(sp.getString(app.aaps.core.utils.R.string.key_virtualpump_type, "Generic AAPS")).thenReturn("Accu-Chek Combo")
|
||||||
virtualPumpPlugin.refreshConfiguration()
|
virtualPumpPlugin.refreshConfiguration()
|
||||||
Assertions.assertEquals(PumpType.ACCU_CHEK_COMBO, virtualPumpPlugin.pumpType)
|
assertThat(virtualPumpPlugin.pumpType).isEqualTo(PumpType.ACCU_CHEK_COMBO)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue