Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
d82328e100
35 changed files with 472 additions and 353 deletions
|
@ -48,9 +48,9 @@
|
|||
<string name="pref_show_detailed_delta">Mostrar delta detallado</string>
|
||||
<string name="pref_show_avgdelta">Mostrar delta promedio</string>
|
||||
<string name="pref_show_phone_battery">Mostrar batería del teléfono</string>
|
||||
<string name="pref_show_rig_battery">Mostrar batería global del lazo</string>
|
||||
<string name="pref_show_rig_battery">Mostrar batería global del bucle</string>
|
||||
<string name="pref_show_basal_rate">Mostrar la tasa basal</string>
|
||||
<string name="pref_show_loop_status">Mostrar estado del lazo</string>
|
||||
<string name="pref_show_loop_status">Mostrar estado del bucle</string>
|
||||
<string name="pref_show_bg">Mostrar glucosa</string>
|
||||
<string name="pref_show_bgi">Mostrar BGI (Índice de glucosa en sangre)</string>
|
||||
<string name="pref_show_direction_arrow">Mostrar flecha de dirección</string>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<string name="cwf_comment_delta">Delta corto de glucosa</string>
|
||||
<string name="cwf_comment_avg_delta">Delta promedio de glucosa (15min)</string>
|
||||
<string name="cwf_comment_uploader_battery">Batería del teléfono (%)</string>
|
||||
<string name="cwf_comment_rig_battery">Batería global de lazo (%)</string>
|
||||
<string name="cwf_comment_rig_battery">Batería global de bucle(%)</string>
|
||||
<string name="cwf_comment_basalRate">Tasa Basal</string>
|
||||
<string name="cwf_comment_bgi">Valor BGI</string>
|
||||
<string name="cwf_comment_time">Tiempo (HH:MM o HH:MM:SS)</string>
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
<string name="pref_show_bgi">Afficher IGly</string>
|
||||
<string name="pref_show_direction_arrow">Afficher Flèche</string>
|
||||
<string name="pref_show_ago">Afficher Min Passées</string>
|
||||
<string name="pref_show_week_number">Afficher numéro semaine</string>
|
||||
<string name="default_custom_watchface_comment">Cadran par défaut, vous pouvez cliquer sur le bouton EXPORTER WATCHFACE pour générer un modèle</string>
|
||||
<string name="wear_default_watchface">Cadran par défaut</string>
|
||||
<string name="cwf_comment_background">Image d\'arrière-plan</string>
|
||||
|
@ -81,6 +82,7 @@
|
|||
<string name="cwf_comment_timePeriod">AM ou PM</string>
|
||||
<string name="cwf_comment_day_name">Nom du jour de la semaine</string>
|
||||
<string name="cwf_comment_day">Jour (JJ)</string>
|
||||
<string name="cwf_comment_week_number">Numéro de semaine (ww)</string>
|
||||
<string name="cwf_comment_month">Nom du mois (court)</string>
|
||||
<string name="cwf_comment_loop">État de la boucle et délais</string>
|
||||
<string name="cwf_comment_direction">Flèche de direction</string>
|
||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.plugins.aps.loop
|
|||
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.core.utils.fabric.FabricPrivacy
|
||||
|
@ -25,7 +26,6 @@ import info.nightscout.shared.interfaces.ResourceHelper
|
|||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.shared.utils.DateUtil
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -74,28 +74,28 @@ class LoopPluginTest : TestBase() {
|
|||
`when`(sp.getString(info.nightscout.core.utils.R.string.key_aps_mode, ApsMode.OPEN.name)).thenReturn(ApsMode.CLOSED.name)
|
||||
val pumpDescription = PumpDescription()
|
||||
`when`(virtualPumpPlugin.pumpDescription).thenReturn(pumpDescription)
|
||||
Assertions.assertEquals(LoopFragment::class.java.name, loopPlugin.pluginDescription.fragmentClass)
|
||||
Assertions.assertEquals(PluginType.LOOP, loopPlugin.getType())
|
||||
Assertions.assertEquals("Loop", loopPlugin.name)
|
||||
Assertions.assertEquals("LOOP", loopPlugin.nameShort)
|
||||
Assertions.assertEquals(true, loopPlugin.hasFragment())
|
||||
Assertions.assertEquals(true, loopPlugin.showInList(PluginType.LOOP))
|
||||
Assertions.assertEquals(info.nightscout.plugins.aps.R.xml.pref_loop.toLong(), loopPlugin.preferencesId.toLong())
|
||||
assertThat(loopPlugin.pluginDescription.fragmentClass).isEqualTo(LoopFragment::class.java.name)
|
||||
assertThat(loopPlugin.getType()).isEqualTo(PluginType.LOOP)
|
||||
assertThat(loopPlugin.name).isEqualTo("Loop")
|
||||
assertThat(loopPlugin.nameShort).isEqualTo("LOOP")
|
||||
assertThat(loopPlugin.hasFragment()).isTrue()
|
||||
assertThat(loopPlugin.showInList(PluginType.LOOP)).isTrue()
|
||||
assertThat(loopPlugin.preferencesId.toLong()).isEqualTo(info.nightscout.plugins.aps.R.xml.pref_loop.toLong())
|
||||
|
||||
// Plugin is disabled by default
|
||||
Assertions.assertEquals(false, loopPlugin.isEnabled())
|
||||
assertThat(loopPlugin.isEnabled()).isFalse()
|
||||
loopPlugin.setPluginEnabled(PluginType.LOOP, true)
|
||||
Assertions.assertEquals(true, loopPlugin.isEnabled())
|
||||
assertThat(loopPlugin.isEnabled()).isTrue()
|
||||
|
||||
// No temp basal capable pump should disable plugin
|
||||
virtualPumpPlugin.pumpDescription.isTempBasalCapable = false
|
||||
Assertions.assertEquals(false, loopPlugin.isEnabled())
|
||||
assertThat(loopPlugin.isEnabled()).isFalse()
|
||||
virtualPumpPlugin.pumpDescription.isTempBasalCapable = true
|
||||
|
||||
// Fragment is hidden by default
|
||||
Assertions.assertEquals(false, loopPlugin.isFragmentVisible())
|
||||
assertThat(loopPlugin.isFragmentVisible()).isFalse()
|
||||
loopPlugin.setFragmentVisible(PluginType.LOOP, true)
|
||||
Assertions.assertEquals(true, loopPlugin.isFragmentVisible())
|
||||
assertThat(loopPlugin.isFragmentVisible()).isTrue()
|
||||
}
|
||||
|
||||
/* *********** not working
|
||||
|
@ -118,7 +118,7 @@ class LoopPluginTest : TestBase() {
|
|||
MockedLoopPlugin mockedLoopPlugin = new MockedLoopPlugin();
|
||||
Treatment t = new Treatment();
|
||||
bus.post(new EventTreatmentChange(t));
|
||||
Assertions.assertEquals(true, mockedLoopPlugin.invokeCalled);
|
||||
assertThat(mockedLoopPlugin.invokeCalled).isTrue();
|
||||
}
|
||||
*/
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package info.nightscout.plugins.general.maintenance
|
||||
|
||||
import android.content.Context
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.configuration.maintenance.MaintenancePlugin
|
||||
import info.nightscout.interfaces.Config
|
||||
|
@ -10,7 +11,6 @@ import info.nightscout.interfaces.nsclient.NSSettingsStatus
|
|||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -40,11 +40,12 @@ class MaintenancePluginTest : TestBase() {
|
|||
|
||||
@Test fun logFilesTest() {
|
||||
var logs = sut.getLogFiles(2)
|
||||
Assertions.assertEquals(2, logs.size)
|
||||
Assertions.assertEquals("AndroidAPS.log", logs[0].name)
|
||||
Assertions.assertEquals("AndroidAPS.2018-01-03_01-01-00.1.zip", logs[1].name)
|
||||
assertThat(logs.map { it.name }).containsExactly(
|
||||
"AndroidAPS.log",
|
||||
"AndroidAPS.2018-01-03_01-01-00.1.zip",
|
||||
).inOrder()
|
||||
logs = sut.getLogFiles(10)
|
||||
Assertions.assertEquals(4, logs.size)
|
||||
assertThat(logs).hasSize(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -53,7 +54,7 @@ class MaintenancePluginTest : TestBase() {
|
|||
val name = "AndroidAPS.log.zip"
|
||||
var zipFile = File("build/$name")
|
||||
zipFile = sut.zipLogs(zipFile, logs)
|
||||
Assertions.assertTrue(zipFile.exists())
|
||||
Assertions.assertTrue(zipFile.isFile)
|
||||
assertThat(zipFile.exists()).isTrue()
|
||||
assertThat(zipFile.isFile).isTrue()
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.plugins.sensitivity
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.interfaces.aps.AutosensDataStore
|
||||
|
@ -12,7 +13,6 @@ import info.nightscout.shared.interfaces.ResourceHelper
|
|||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
||||
|
@ -45,12 +45,12 @@ class AbstractSensitivityPluginTest : TestBase() {
|
|||
fun fillResultTest() {
|
||||
val sut = SensitivityTestClass(pluginDescription, aapsLogger, rh, sp)
|
||||
var ar = sut.fillResult(1.0, 1.0, "1", "1.2", "1", 12, 0.7, 1.2)
|
||||
Assertions.assertEquals(1.0, ar.ratio, 0.01)
|
||||
assertThat(ar.ratio).isWithin(0.01).of(1.0)
|
||||
ar = sut.fillResult(1.2, 1.0, "1", "1.2", "1", 40, 0.7, 1.2)
|
||||
Assertions.assertEquals(1.16, ar.ratio, 0.01)
|
||||
assertThat(ar.ratio).isWithin(0.01).of(1.16)
|
||||
ar = sut.fillResult(1.2, 1.0, "1", "1.2", "1", 50, 0.7, 1.2)
|
||||
Assertions.assertEquals(1.2, ar.ratio, 0.01)
|
||||
assertThat(ar.ratio).isWithin(0.01).of(1.2)
|
||||
ar = sut.fillResult(1.2, 1.0, "1", "1.2", "1", 50, 0.7, 1.1)
|
||||
Assertions.assertEquals(1.1, ar.ratio, 0.01)
|
||||
assertThat(ar.ratio).isWithin(0.01).of(1.1)
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.pump
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import info.nightscout.core.pump.toHtml
|
||||
|
@ -8,7 +9,6 @@ import info.nightscout.plugins.aps.loop.extensions.json
|
|||
import info.nightscout.pump.virtual.extensions.toText
|
||||
import info.nightscout.sharedtests.TestBaseWithProfile
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
|
@ -42,132 +42,132 @@ class PumpEnactResultTest : TestBaseWithProfile() {
|
|||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.success(true)
|
||||
Assertions.assertEquals(true, per.success)
|
||||
assertThat(per.success).isTrue()
|
||||
}
|
||||
|
||||
@Test fun enactedTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.enacted(true)
|
||||
Assertions.assertEquals(true, per.enacted)
|
||||
assertThat(per.enacted).isTrue()
|
||||
}
|
||||
|
||||
@Test fun commentTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.comment("SomeComment")
|
||||
Assertions.assertEquals("SomeComment", per.comment)
|
||||
assertThat(per.comment).isEqualTo("SomeComment")
|
||||
}
|
||||
|
||||
@Test fun durationTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.duration(10)
|
||||
Assertions.assertEquals(10, per.duration.toLong())
|
||||
assertThat(per.duration.toLong()).isEqualTo(10L)
|
||||
}
|
||||
|
||||
@Test fun absoluteTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.absolute(11.0)
|
||||
Assertions.assertEquals(11.0, per.absolute, 0.01)
|
||||
assertThat(per.absolute).isWithin(0.01).of(11.0)
|
||||
}
|
||||
|
||||
@Test fun percentTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.percent(10)
|
||||
Assertions.assertEquals(10, per.percent)
|
||||
assertThat(per.percent).isEqualTo(10)
|
||||
}
|
||||
|
||||
@Test fun isPercentTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.isPercent(true)
|
||||
Assertions.assertEquals(true, per.isPercent)
|
||||
assertThat(per.isPercent).isTrue()
|
||||
}
|
||||
|
||||
@Test fun isTempCancelTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.isTempCancel(true)
|
||||
Assertions.assertEquals(true, per.isTempCancel)
|
||||
assertThat(per.isTempCancel).isTrue()
|
||||
}
|
||||
|
||||
@Test fun bolusDeliveredTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.bolusDelivered(11.0)
|
||||
Assertions.assertEquals(11.0, per.bolusDelivered, 0.01)
|
||||
assertThat(per.bolusDelivered).isWithin(0.01).of(11.0)
|
||||
}
|
||||
|
||||
@Test fun queuedTest() {
|
||||
val per = PumpEnactResult(injector)
|
||||
|
||||
per.queued(true)
|
||||
Assertions.assertEquals(true, per.queued)
|
||||
assertThat(per.queued).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toStringTest() {
|
||||
var per = PumpEnactResult(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
|
||||
Assertions.assertEquals(
|
||||
assertThat(per.toText(rh)).isEqualTo(
|
||||
"""
|
||||
Success: false
|
||||
Enacted: true
|
||||
Comment: AAA
|
||||
Insulin: 10.0 U
|
||||
""".trimIndent(), per.toText(rh)
|
||||
""".trimIndent()
|
||||
)
|
||||
per = PumpEnactResult(injector).enacted(true).isTempCancel(true).comment("AAA")
|
||||
Assertions.assertEquals(
|
||||
assertThat(per.toText(rh)).isEqualTo(
|
||||
"""
|
||||
Success: false
|
||||
Enacted: true
|
||||
Comment: AAA
|
||||
Cancel temp basal
|
||||
""".trimIndent(), per.toText(rh)
|
||||
""".trimIndent()
|
||||
)
|
||||
per = PumpEnactResult(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
|
||||
Assertions.assertEquals(
|
||||
assertThat(per.toText(rh)).isEqualTo(
|
||||
"""
|
||||
Success: false
|
||||
Enacted: true
|
||||
Comment: AAA
|
||||
Duration: 20 min
|
||||
Percent: 90%
|
||||
""".trimIndent(), per.toText(rh)
|
||||
""".trimIndent()
|
||||
)
|
||||
per = PumpEnactResult(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
|
||||
Assertions.assertEquals(
|
||||
assertThat(per.toText(rh)).isEqualTo(
|
||||
"""
|
||||
Success: false
|
||||
Enacted: true
|
||||
Comment: AAA
|
||||
Duration: 30 min
|
||||
Absolute: 1.0 U/h
|
||||
""".trimIndent(), per.toText(rh)
|
||||
""".trimIndent()
|
||||
)
|
||||
per = PumpEnactResult(injector).enacted(false).comment("AAA")
|
||||
Assertions.assertEquals(
|
||||
assertThat(per.toText(rh)).isEqualTo(
|
||||
"""
|
||||
Success: false
|
||||
Comment: AAA
|
||||
""".trimIndent(), per.toText(rh)
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun toHtmlTest() {
|
||||
|
||||
var per: PumpEnactResult = PumpEnactResult(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
|
||||
Assertions.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>SMB</b>: 10.0 U", per.toHtml(rh, decimalFormatter))
|
||||
assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>SMB</b>: 10.0 U")
|
||||
per = PumpEnactResult(injector).enacted(true).isTempCancel(true).comment("AAA")
|
||||
Assertions.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br>Cancel temp basal", per.toHtml(rh, decimalFormatter))
|
||||
assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br>Cancel temp basal")
|
||||
per = PumpEnactResult(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
|
||||
Assertions.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>Duration</b>: 20 min<br><b>Percent</b>: 90%", per.toHtml(rh, decimalFormatter))
|
||||
assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>Duration</b>: 20 min<br><b>Percent</b>: 90%")
|
||||
per = PumpEnactResult(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
|
||||
Assertions.assertEquals("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>Duration</b>: 30 min<br><b>Absolute</b>: 1.00 U/h", per.toHtml(rh, decimalFormatter))
|
||||
assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("<b>Success</b>: false<br><b>Enacted</b>: true<br><b>Comment</b>: AAA<br><b>Duration</b>: 30 min<br><b>Absolute</b>: 1.00 U/h")
|
||||
per = PumpEnactResult(injector).enacted(false).comment("AAA")
|
||||
Assertions.assertEquals("<b>Success</b>: false<br><b>Comment</b>: AAA", per.toHtml(rh, decimalFormatter))
|
||||
assertThat(per.toHtml(rh, decimalFormatter)).isEqualTo("<b>Success</b>: false<br><b>Comment</b>: AAA")
|
||||
}
|
||||
|
||||
@Test fun jsonTest() {
|
||||
|
@ -175,15 +175,15 @@ class PumpEnactResultTest : TestBaseWithProfile() {
|
|||
|
||||
var per: PumpEnactResult = PumpEnactResult(injector).enacted(true).bolusDelivered(10.0).comment("AAA")
|
||||
o = per.json(validProfile.getBasal())
|
||||
JSONAssert.assertEquals("{\"smb\":10}", o, false)
|
||||
JSONAssert.assertEquals("""{"smb":10}""", o, false)
|
||||
per = PumpEnactResult(injector).enacted(true).isTempCancel(true).comment("AAA")
|
||||
o = per.json(validProfile.getBasal())
|
||||
JSONAssert.assertEquals("{\"rate\":0,\"duration\":0}", o, false)
|
||||
JSONAssert.assertEquals("""{"rate":0,"duration":0}""", o, false)
|
||||
per = PumpEnactResult(injector).enacted(true).isPercent(true).percent(90).duration(20).comment("AAA")
|
||||
o = per.json(validProfile.getBasal())
|
||||
JSONAssert.assertEquals("{\"rate\":0.9,\"duration\":20}", o, false)
|
||||
JSONAssert.assertEquals("""{"rate":0.9,"duration":20}""", o, false)
|
||||
per = PumpEnactResult(injector).enacted(true).isPercent(false).absolute(1.0).duration(30).comment("AAA")
|
||||
o = per.json(validProfile.getBasal())
|
||||
JSONAssert.assertEquals("{\"rate\":1,\"duration\":30}", o, false)
|
||||
JSONAssert.assertEquals("""{"rate":1,"duration":30}""", o, false)
|
||||
}
|
||||
}
|
|
@ -1,2 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
<string name="format_carbs">%1$d g</string>
|
||||
</resources>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<string name="bolus_delivered_successfully">Bolo %1$.2fU entregado correctamente</string>
|
||||
<string name="no_valid_basal_rate">Tasa basal no válida leída en la bomba</string>
|
||||
<string name="limiting_iob">Limitando IOB a %1$.1f U debido a %2$s</string>
|
||||
<string name="loop_disabled">LAZO DESACTIVADO POR RESTRICCIONES</string>
|
||||
<string name="loop_disabled">BUCLE DESACTIVADO POR RESTRICCIONES</string>
|
||||
<string name="event_type">Tipo de evento</string>
|
||||
<string name="reload">Recargar</string>
|
||||
<string name="mgdl">mg/dl</string>
|
||||
|
@ -86,11 +86,11 @@
|
|||
<string name="pump_time_updated">Hora actualizada en la bomba</string>
|
||||
<string name="exit">Salir</string>
|
||||
<string name="removerecord">Eliminar registro</string>
|
||||
<string name="loopisdisabled">Lazo desactivado</string>
|
||||
<string name="loopisdisabled">Bucle desactivado</string>
|
||||
<string name="alarm">Alarma</string>
|
||||
<string name="disableloop">Desactivar lazo</string>
|
||||
<string name="enableloop">Activar lazo</string>
|
||||
<string name="resumeloop">Reanudar el lazo</string>
|
||||
<string name="disableloop">Desactivar bucle</string>
|
||||
<string name="enableloop">Activar bucle</string>
|
||||
<string name="resumeloop">Reanudar el bucle</string>
|
||||
<string name="suspendloop">Suspender lazo</string>
|
||||
<string name="duration_min_label">Duración [min]</string>
|
||||
<string name="notification">Notificación</string>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<string name="shortgramm">g</string>
|
||||
<string name="pumpsuspended">Bomba parada</string>
|
||||
<string name="notconfigured">Sin configurar</string>
|
||||
<string name="loopsuspended">Lazo suspendido</string>
|
||||
<string name="loopsuspended">Bucle suspendido</string>
|
||||
<string name="trend_arrow">Flecha de tendencia</string>
|
||||
<string name="a11y_autosens_label">Auto sens</string>
|
||||
<string name="required">req</string>
|
||||
|
@ -156,8 +156,8 @@
|
|||
<string name="prime_fill">Cebar/Llenar</string>
|
||||
<string name="overview_insulin_label">Insulina</string>
|
||||
<string name="stoptemptarget">Detener objetivo temporal</string>
|
||||
<string name="closedloop">Lazo cerrado</string>
|
||||
<string name="openloop">Lazo abierto</string>
|
||||
<string name="closedloop">Bucle cerrado</string>
|
||||
<string name="openloop">Bucle abierto</string>
|
||||
<string name="lowglucosesuspend">Suspensión por glucosa baja (LGS)</string>
|
||||
<string name="dia">DIA</string>
|
||||
<string name="ic_short">IC</string>
|
||||
|
@ -165,7 +165,7 @@
|
|||
<string name="canceling_tbr_failed">Error cancelando la basal temporal</string>
|
||||
<string name="canceling_eb_failed">Error cancelando el bolo extendido</string>
|
||||
<string name="virtualpump_uploadstatus_title">Subir estado de la bomba a NS o Tidepool</string>
|
||||
<string name="suspendloop_label">Desactiva/suspende el lazo</string>
|
||||
<string name="suspendloop_label">Desactiva/suspende el bucle</string>
|
||||
<string name="iob_label">Insulina a bordo (IOB)</string>
|
||||
<!-- Protection-->
|
||||
<string name="wrongpassword">Contraseña incorrecta</string>
|
||||
|
@ -234,7 +234,7 @@
|
|||
<string name="wear">Reloj</string>
|
||||
<string name="automation">Automatización</string>
|
||||
<string name="custom">Personalizado</string>
|
||||
<string name="loop">Lazo</string>
|
||||
<string name="loop">Bucle</string>
|
||||
<string name="ns">NS</string>
|
||||
<string name="record">Registro</string>
|
||||
<!-- Command-->
|
||||
|
@ -278,11 +278,11 @@
|
|||
<string name="uel_store_profile">GUARDAR PERFIL</string>
|
||||
<string name="uel_profile_switch">CAMBIO DE PERFIL</string>
|
||||
<string name="uel_profile_switch_cloned">CAMBIO DE PERFIL CLONADO</string>
|
||||
<string name="uel_closed_loop_mode">MODO LAZO CERRADO</string>
|
||||
<string name="uel_lgs_loop_mode">MODO LAZO LGS</string>
|
||||
<string name="uel_open_loop_mode">MODO LAZO ABIERTO</string>
|
||||
<string name="uel_loop_disabled">LAZO DESACTIVADO</string>
|
||||
<string name="uel_loop_enabled">LAZO ACTIVADO</string>
|
||||
<string name="uel_closed_loop_mode">MODO BUCLE CERRADO</string>
|
||||
<string name="uel_lgs_loop_mode">MODO BUCLE LGS</string>
|
||||
<string name="uel_open_loop_mode">MODO BUCLE ABIERTO</string>
|
||||
<string name="uel_loop_disabled">BUCLE DESACTIVADO</string>
|
||||
<string name="uel_loop_enabled">BUCLE ACTIVADO</string>
|
||||
<string name="uel_reconnect">RECONECTAR</string>
|
||||
<string name="uel_disconnect">DESCONECTAR</string>
|
||||
<string name="uel_resume">REANUDAR</string>
|
||||
|
@ -353,8 +353,8 @@
|
|||
<string name="ue_action">Acción</string>
|
||||
<string name="ue_timestamp">Fecha y hora</string>
|
||||
<string name="ue_none">Sin Unidad</string>
|
||||
<string name="uel_loop_change">LAZO CAMBIADO</string>
|
||||
<string name="uel_loop_removed">LAZO ELIMINADO</string>
|
||||
<string name="uel_loop_change">BUCLE CAMBIADO</string>
|
||||
<string name="uel_loop_removed">BUCLE ELIMINADO</string>
|
||||
<string name="uel_other">OTROS</string>
|
||||
<!-- HardLimits -->
|
||||
<string name="profile_low_target">Perfil de objetivo bajo</string>
|
||||
|
|
|
@ -581,6 +581,22 @@
|
|||
<string name="cleanup_db_confirm_sync">Voulez-vous nettoyer la base de données ?\nCela supprimera les modifications suivies et les données historiques de plus de 3 mois.\nCela accélérera la synchronisation complète de manière spectaculaire.</string>
|
||||
<string name="cleared_entries">Entrées effacées</string>
|
||||
<!-- Weekday-->
|
||||
<string name="weekday_sunday_short">Dim</string>
|
||||
<string name="weekday_saturday_short">Sam</string>
|
||||
<string name="weekday_friday_short">Ven</string>
|
||||
<string name="weekday_thursday_short">Jeu</string>
|
||||
<string name="weekday_wednesday_short">Mer</string>
|
||||
<string name="weekday_tuesday_short">Mar</string>
|
||||
<string name="weekday_monday_short">Lun</string>
|
||||
<!-- WeekdayPicker -->
|
||||
<string name="monday_short">L</string>
|
||||
<string name="tuesday_short">M</string>
|
||||
<string name="wednesday_short">M</string>
|
||||
<string name="thursday_short">J</string>
|
||||
<string name="friday_short">V</string>
|
||||
<string name="saturday_short">S</string>
|
||||
<string name="sunday_short">D</string>
|
||||
<!-- DecimalFormatterImpl -->
|
||||
<string name="format_insulin_units1">%1$.1f U</string>
|
||||
<string name="format_insulin_units">%1$.2f U</string>
|
||||
</resources>
|
||||
|
|
|
@ -581,6 +581,22 @@
|
|||
<string name="cleanup_db_confirm_sync">Wil je de database opschonen?\nHet zal bijgehouden wijzigingen en historische gegevens ouder dan 3 maanden verwijderen.\nDit zal de volledige synchronisatie drastisch versnellen.</string>
|
||||
<string name="cleared_entries">Invoer gewist</string>
|
||||
<!-- Weekday-->
|
||||
<string name="weekday_sunday_short">Zo</string>
|
||||
<string name="weekday_saturday_short">Za</string>
|
||||
<string name="weekday_friday_short">Vr</string>
|
||||
<string name="weekday_thursday_short">Do</string>
|
||||
<string name="weekday_wednesday_short">Wo</string>
|
||||
<string name="weekday_tuesday_short">Di</string>
|
||||
<string name="weekday_monday_short">Ma</string>
|
||||
<!-- WeekdayPicker -->
|
||||
<string name="monday_short">M</string>
|
||||
<string name="tuesday_short">D</string>
|
||||
<string name="wednesday_short">W</string>
|
||||
<string name="thursday_short">D</string>
|
||||
<string name="friday_short">V</string>
|
||||
<string name="saturday_short">Z</string>
|
||||
<string name="sunday_short">Z</string>
|
||||
<!-- DecimalFormatterImpl -->
|
||||
<string name="format_insulin_units1">%1$.1f E</string>
|
||||
<string name="format_insulin_units">%1$.2f E</string>
|
||||
</resources>
|
||||
|
|
|
@ -581,6 +581,22 @@
|
|||
<string name="cleanup_db_confirm_sync">Vil du rydde opp i databasen?\nDet vil fjerne sporede endringer og historiske data eldre enn 3 måneder.\nÅ gjøre dette vil øke hastigheten på synkronisering betydelig.</string>
|
||||
<string name="cleared_entries">Fjernet oppføringer</string>
|
||||
<!-- Weekday-->
|
||||
<string name="weekday_sunday_short">Søn</string>
|
||||
<string name="weekday_saturday_short">Lør</string>
|
||||
<string name="weekday_friday_short">Fre</string>
|
||||
<string name="weekday_thursday_short">Tor</string>
|
||||
<string name="weekday_wednesday_short">Ons</string>
|
||||
<string name="weekday_tuesday_short">Tir</string>
|
||||
<string name="weekday_monday_short">Man</string>
|
||||
<!-- WeekdayPicker -->
|
||||
<string name="monday_short">M</string>
|
||||
<string name="tuesday_short">Ti</string>
|
||||
<string name="wednesday_short">O</string>
|
||||
<string name="thursday_short">To</string>
|
||||
<string name="friday_short">F</string>
|
||||
<string name="saturday_short">L</string>
|
||||
<string name="sunday_short">S</string>
|
||||
<!-- DecimalFormatterImpl -->
|
||||
<string name="format_insulin_units1">%1$.1f E</string>
|
||||
<string name="format_insulin_units">%1$.2f E</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.implementation.iob
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.core.iob.asRounded
|
||||
import info.nightscout.core.iob.log
|
||||
import info.nightscout.database.entities.GlucoseValue
|
||||
|
@ -9,7 +10,6 @@ import info.nightscout.interfaces.iob.InMemoryGlucoseValue
|
|||
import info.nightscout.interfaces.iob.IobCobCalculator
|
||||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.sharedtests.TestBaseWithProfile
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -30,106 +30,106 @@ class GlucoseStatusTest : TestBaseWithProfile() {
|
|||
|
||||
@Test fun toStringShouldBeOverloaded() {
|
||||
val glucoseStatus = GlucoseStatus(glucose = 0.0, noise = 0.0, delta = 0.0, shortAvgDelta = 0.0, longAvgDelta = 0.0, date = 0)
|
||||
Assertions.assertEquals(true, glucoseStatus.log(decimalFormatter).contains("Delta"))
|
||||
assertThat(glucoseStatus.log(decimalFormatter)).contains("Delta")
|
||||
}
|
||||
|
||||
@Test fun roundTest() {
|
||||
val glucoseStatus = GlucoseStatus(glucose = 100.11111, noise = 0.0, delta = 0.0, shortAvgDelta = 0.0, longAvgDelta = 0.0, date = 0)
|
||||
Assertions.assertEquals(100.1, glucoseStatus.asRounded().glucose, 0.0001)
|
||||
assertThat(glucoseStatus.asRounded().glucose).isWithin(0.0001).of(100.1)
|
||||
}
|
||||
|
||||
@Test fun calculateValidGlucoseStatus() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateValidBgData())
|
||||
val glucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData!!
|
||||
Assertions.assertEquals(214.0, glucoseStatus.glucose, 0.001)
|
||||
Assertions.assertEquals(-2.0, glucoseStatus.delta, 0.001)
|
||||
Assertions.assertEquals(-2.5, glucoseStatus.shortAvgDelta, 0.001) // -2 -2.5 -3 deltas are relative to current value
|
||||
Assertions.assertEquals(-2.0, glucoseStatus.longAvgDelta, 0.001) // -2 -2 -2 -2
|
||||
Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date
|
||||
assertThat(glucoseStatus.glucose).isWithin(0.001).of(214.0)
|
||||
assertThat(glucoseStatus.delta).isWithin(0.001).of(-2.0)
|
||||
assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(-2.5) // -2 -2.5 -3 deltas are relative to current value
|
||||
assertThat(glucoseStatus.longAvgDelta).isWithin(0.001).of(-2.0) // -2 -2 -2 -2
|
||||
assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date
|
||||
}
|
||||
/*
|
||||
Not testing anymore, not valid for bucketed data
|
||||
/*
|
||||
Not testing anymore, not valid for bucketed data
|
||||
|
||||
@Test fun calculateMostRecentGlucoseStatus() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateMostRecentBgData())
|
||||
val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
|
||||
Assertions.assertEquals(215.0, glucoseStatus.glucose, 0.001) // (214+216) / 2
|
||||
Assertions.assertEquals(-1.0, glucoseStatus.delta, 0.001)
|
||||
Assertions.assertEquals(-1.0, glucoseStatus.shortAvgDelta, 0.001)
|
||||
Assertions.assertEquals(0.0, glucoseStatus.longAvgDelta, 0.001)
|
||||
Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date, even when averaging
|
||||
}
|
||||
@Test fun calculateMostRecentGlucoseStatus() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateMostRecentBgData())
|
||||
val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
|
||||
assertThat(glucoseStatus.glucose).isWithin(0.001).of(215.0) // (214+216) / 2
|
||||
assertThat(glucoseStatus.delta).isWithin(0.001).of(-1.0)
|
||||
assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(-1.0)
|
||||
assertThat( glucoseStatus.longAvgDelta).isWithin(0.001).of(0.0)
|
||||
assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date, even when averaging
|
||||
}
|
||||
|
||||
private fun generateMostRecentBgData(): MutableList<InMemoryGlucoseValue> {
|
||||
val list: MutableList<InMemoryGlucoseValue> = ArrayList()
|
||||
list.add(InMemoryGlucoseValue(value = 214.0, timestamp = 1514766900000, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766800000, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766600000, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
return list
|
||||
}
|
||||
*/
|
||||
private fun generateMostRecentBgData(): MutableList<InMemoryGlucoseValue> {
|
||||
val list: MutableList<InMemoryGlucoseValue> = ArrayList()
|
||||
list.add(InMemoryGlucoseValue(value = 214.0, timestamp = 1514766900000, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766800000, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
list.add(InMemoryGlucoseValue(value = 216.0, timestamp = 1514766600000, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
return list
|
||||
}
|
||||
*/
|
||||
|
||||
@Test fun oneRecordShouldProduceZeroDeltas() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOneCurrentRecordBgData())
|
||||
val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData!!
|
||||
Assertions.assertEquals(214.0, glucoseStatus.glucose, 0.001)
|
||||
Assertions.assertEquals(0.0, glucoseStatus.delta, 0.001)
|
||||
Assertions.assertEquals(0.0, glucoseStatus.shortAvgDelta, 0.001) // -2 -2.5 -3 deltas are relative to current value
|
||||
Assertions.assertEquals(0.0, glucoseStatus.longAvgDelta, 0.001) // -2 -2 -2 -2
|
||||
Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date
|
||||
assertThat(glucoseStatus.glucose).isWithin(0.001).of(214.0)
|
||||
assertThat(glucoseStatus.delta).isWithin(0.001).of(0.0)
|
||||
assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(0.0) // -2 -2.5 -3 deltas are relative to current value
|
||||
assertThat(glucoseStatus.longAvgDelta).isWithin(0.001).of(0.0) // -2 -2 -2 -2
|
||||
assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date
|
||||
}
|
||||
|
||||
@Test fun insufficientDataShouldReturnNull() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateInsufficientBgData())
|
||||
val glucoseStatus: GlucoseStatus? = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData
|
||||
Assertions.assertEquals(null, glucoseStatus)
|
||||
assertThat(glucoseStatus).isNull()
|
||||
}
|
||||
|
||||
@Test fun oldDataShouldReturnNull() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOldBgData())
|
||||
val glucoseStatus: GlucoseStatus? = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).glucoseStatusData
|
||||
Assertions.assertEquals(null, glucoseStatus)
|
||||
assertThat(glucoseStatus).isNull()
|
||||
}
|
||||
|
||||
@Test fun returnOldDataIfAllowed() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOldBgData())
|
||||
val glucoseStatus: GlucoseStatus? = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil, decimalFormatter).getGlucoseStatusData(true)
|
||||
Assertions.assertNotEquals(null, glucoseStatus)
|
||||
assertThat(glucoseStatus).isNull()
|
||||
}
|
||||
|
||||
@Test fun averageShouldNotFailOnEmptyArray() {
|
||||
Assertions.assertEquals(0.0, GlucoseStatusProviderImpl.average(ArrayList()), 0.001)
|
||||
assertThat(GlucoseStatusProviderImpl.average(ArrayList())).isWithin(0.001).of(0.0)
|
||||
}
|
||||
|
||||
/*
|
||||
Not testing anymore, not valid for bucketed data
|
||||
/*
|
||||
Not testing anymore, not valid for bucketed data
|
||||
|
||||
@Test fun calculateGlucoseStatusForLibreTestBgData() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateLibreTestData())
|
||||
val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
|
||||
Assertions.assertEquals(100.0, glucoseStatus.glucose, 0.001) //
|
||||
Assertions.assertEquals(-10.0, glucoseStatus.delta, 0.001)
|
||||
Assertions.assertEquals(-10.0, glucoseStatus.shortAvgDelta, 0.001)
|
||||
Assertions.assertEquals(-10.0, glucoseStatus.longAvgDelta, 0.001)
|
||||
Assertions.assertEquals(1514766900000L, glucoseStatus.date) // latest date
|
||||
}
|
||||
@Test fun calculateGlucoseStatusForLibreTestBgData() {
|
||||
Mockito.`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateLibreTestData())
|
||||
val glucoseStatus: GlucoseStatus = GlucoseStatusProviderImpl(aapsLogger, iobCobCalculatorPlugin, dateUtil).glucoseStatusData!!
|
||||
assertThat(glucoseStatus.glucose).isWithin(0.001).of(100.0)
|
||||
assertThat(glucoseStatus.delta).isWithin(0.001).of(-10.0)
|
||||
assertThat(glucoseStatus.shortAvgDelta).isWithin(0.001).of(-10.0)
|
||||
assertThat(glucoseStatus.longAvgDelta).isWithin(0.001).of(-10.0)
|
||||
assertThat(glucoseStatus.date).isEqualTo(1514766900000L) // latest date
|
||||
}
|
||||
|
||||
private fun generateLibreTestData(): MutableList<InMemoryGlucoseValue> {
|
||||
val list: MutableList<InMemoryGlucoseValue> = ArrayList()
|
||||
val endTime = 1514766900000L
|
||||
val latestReading = 100.0
|
||||
// Now
|
||||
list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
// One minute ago
|
||||
list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 1, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
// Two minutes ago
|
||||
list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 2, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
// Three minutes and beyond at constant rate
|
||||
for (i in 3..49)
|
||||
list.add(InMemoryGlucoseValue(value = latestReading + i * 2, timestamp = endTime - 1000 * 60 * i, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
return list
|
||||
}
|
||||
*/
|
||||
private fun generateLibreTestData(): MutableList<InMemoryGlucoseValue> {
|
||||
val list: MutableList<InMemoryGlucoseValue> = ArrayList()
|
||||
val endTime = 1514766900000L
|
||||
val latestReading = 100.0
|
||||
// Now
|
||||
list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
// One minute ago
|
||||
list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 1, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
// Two minutes ago
|
||||
list.add(InMemoryGlucoseValue(value = latestReading, timestamp = endTime - 1000 * 60 * 2, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
// Three minutes and beyond at constant rate
|
||||
for (i in 3..49)
|
||||
list.add(InMemoryGlucoseValue(value = latestReading + i * 2, timestamp = endTime - 1000 * 60 * i, trendArrow = GlucoseValue.TrendArrow.FLAT))
|
||||
return list
|
||||
}
|
||||
*/
|
||||
|
||||
@BeforeEach
|
||||
fun initMocking() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.implementation.overview
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.database.ValueWrapper
|
||||
import info.nightscout.database.entities.GlucoseValue
|
||||
import info.nightscout.database.impl.AppRepository
|
||||
|
@ -10,7 +11,6 @@ import info.nightscout.interfaces.profile.DefaultValueHelper
|
|||
import info.nightscout.shared.utils.T
|
||||
import info.nightscout.sharedtests.TestBaseWithProfile
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -43,23 +43,23 @@ class OverviewDataImplTest : TestBaseWithProfile() {
|
|||
// no data
|
||||
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
|
||||
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Absent()))
|
||||
Assertions.assertNull(sut.lastBg(autosensDataStore))
|
||||
Assertions.assertFalse(sut.isLow(autosensDataStore))
|
||||
Assertions.assertFalse(sut.isHigh(autosensDataStore))
|
||||
assertThat(sut.lastBg(autosensDataStore)).isNull()
|
||||
assertThat(sut.isLow(autosensDataStore)).isFalse()
|
||||
assertThat(sut.isHigh(autosensDataStore)).isFalse()
|
||||
|
||||
// no bucketed but in db
|
||||
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
|
||||
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Existing(glucoseValue)))
|
||||
Assertions.assertEquals(200.0, sut.lastBg(autosensDataStore)?.value)
|
||||
Assertions.assertFalse(sut.isLow(autosensDataStore))
|
||||
Assertions.assertTrue(sut.isHigh(autosensDataStore))
|
||||
assertThat(sut.lastBg(autosensDataStore)?.value).isEqualTo(200.0)
|
||||
assertThat(sut.isLow(autosensDataStore)).isFalse()
|
||||
assertThat(sut.isHigh(autosensDataStore)).isTrue()
|
||||
|
||||
// in bucketed
|
||||
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(bucketedData)
|
||||
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Existing(glucoseValue)))
|
||||
Assertions.assertEquals(70.0, sut.lastBg(autosensDataStore)?.value)
|
||||
Assertions.assertTrue(sut.isLow(autosensDataStore))
|
||||
Assertions.assertFalse(sut.isHigh(autosensDataStore))
|
||||
assertThat(sut.lastBg(autosensDataStore)?.value).isEqualTo(70.0)
|
||||
assertThat(sut.isLow(autosensDataStore)).isTrue()
|
||||
assertThat(sut.isHigh(autosensDataStore)).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -68,13 +68,13 @@ class OverviewDataImplTest : TestBaseWithProfile() {
|
|||
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
|
||||
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Existing(glucoseValue)))
|
||||
Mockito.`when`(dateUtil.now()).thenReturn(time + T.mins(1).msecs())
|
||||
Assertions.assertTrue(sut.isActualBg(autosensDataStore))
|
||||
assertThat(sut.isActualBg(autosensDataStore)).isTrue()
|
||||
Mockito.`when`(dateUtil.now()).thenReturn(time + T.mins(9).msecs() + 1)
|
||||
Assertions.assertFalse(sut.isActualBg(autosensDataStore))
|
||||
assertThat(sut.isActualBg(autosensDataStore)).isFalse()
|
||||
|
||||
// no data
|
||||
Mockito.`when`(autosensDataStore.bucketedData).thenReturn(null)
|
||||
Mockito.`when`(repository.getLastGlucoseValueWrapped()).thenReturn(Single.just(ValueWrapper.Absent()))
|
||||
Assertions.assertFalse(sut.isActualBg(autosensDataStore))
|
||||
assertThat(sut.isActualBg(autosensDataStore)).isFalse()
|
||||
}
|
||||
}
|
|
@ -1,47 +1,47 @@
|
|||
package info.nightscout.implementation.profile
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.interfaces.profile.PureProfile
|
||||
import info.nightscout.sharedtests.TestBaseWithProfile
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
internal class ProfileStoreTest : TestBaseWithProfile() {
|
||||
|
||||
@Test
|
||||
fun getStartDateTest() {
|
||||
Assertions.assertEquals(0, getValidProfileStore().getStartDate())
|
||||
assertThat(getValidProfileStore().getStartDate()).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getDefaultProfileTest() {
|
||||
Assertions.assertTrue(getValidProfileStore().getDefaultProfile() is PureProfile)
|
||||
assertThat(getValidProfileStore().getDefaultProfile()).isInstanceOf(PureProfile::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getDefaultProfileJsonTest() {
|
||||
Assertions.assertTrue(getValidProfileStore().getDefaultProfileJson()?.has("dia") ?: false)
|
||||
Assertions.assertEquals(null, getInvalidProfileStore2().getDefaultProfileJson())
|
||||
assertThat(getValidProfileStore().getDefaultProfileJson()?.has("dia")).isTrue()
|
||||
assertThat(getInvalidProfileStore2().getDefaultProfileJson()).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getDefaultProfileNameTest() {
|
||||
Assertions.assertEquals(TESTPROFILENAME, getValidProfileStore().getDefaultProfileName())
|
||||
assertThat(getValidProfileStore().getDefaultProfileName()).isEqualTo(TESTPROFILENAME)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getProfileListTest() {
|
||||
Assertions.assertEquals(1, getValidProfileStore().getProfileList().size)
|
||||
assertThat(getValidProfileStore().getProfileList()).hasSize(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun getSpecificProfileTest() {
|
||||
Assertions.assertTrue(getValidProfileStore().getSpecificProfile(TESTPROFILENAME) is PureProfile)
|
||||
assertThat(getValidProfileStore().getSpecificProfile(TESTPROFILENAME)).isInstanceOf(PureProfile::class.java)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun allProfilesValidTest() {
|
||||
Assertions.assertTrue(getValidProfileStore().allProfilesValid)
|
||||
Assertions.assertFalse(getInvalidProfileStore1().allProfilesValid)
|
||||
Assertions.assertFalse(getInvalidProfileStore2().allProfilesValid)
|
||||
assertThat(getValidProfileStore().allProfilesValid).isTrue()
|
||||
assertThat(getInvalidProfileStore1().allProfilesValid).isFalse()
|
||||
assertThat(getInvalidProfileStore2().allProfilesValid).isFalse()
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package info.nightscout.implementation.profile
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.database.entities.GlucoseValue
|
||||
import info.nightscout.implementation.utils.DecimalFormatterImpl
|
||||
import info.nightscout.interfaces.GlucoseUnit
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -29,19 +29,19 @@ class ProfileUtilImplTest : TestBase() {
|
|||
|
||||
@Test
|
||||
fun toUnitsString() {
|
||||
Assertions.assertEquals("100", sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MGDL))
|
||||
Assertions.assertEquals("5.6", sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MMOL))
|
||||
Assertions.assertEquals(0.1, sut.convertToMgdl(0.1, GlucoseUnit.MGDL), 0.01)
|
||||
Assertions.assertEquals(18.0, sut.convertToMgdl(1.0, GlucoseUnit.MMOL), 0.01)
|
||||
Assertions.assertEquals(1.0, sut.convertToMmol(18.0, GlucoseUnit.MGDL), 0.01)
|
||||
Assertions.assertEquals(18.0, sut.convertToMmol(18.0, GlucoseUnit.MMOL), 0.01)
|
||||
Assertions.assertEquals(18.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL), 0.01)
|
||||
Assertions.assertEquals(1.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL), 0.01)
|
||||
Assertions.assertEquals(18.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL), 0.01)
|
||||
Assertions.assertEquals(1.0, sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL), 0.01)
|
||||
Assertions.assertEquals("18", sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MGDL))
|
||||
Assertions.assertEquals("1.0", sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MMOL).replace(",", "."))
|
||||
Assertions.assertEquals("5 - 6", sut.toTargetRangeString(5.0, 6.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL))
|
||||
Assertions.assertEquals("4", sut.toTargetRangeString(4.0, 4.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL))
|
||||
assertThat(sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MGDL)).isEqualTo("100")
|
||||
assertThat(sut.fromMgdlToStringInUnits(glucoseValue.value, GlucoseUnit.MMOL)).isEqualTo("5.6")
|
||||
assertThat(sut.convertToMgdl(0.1, GlucoseUnit.MGDL)).isWithin(0.01).of(0.1)
|
||||
assertThat(sut.convertToMgdl(1.0, GlucoseUnit.MMOL)).isWithin(0.01).of(18.0)
|
||||
assertThat(sut.convertToMmol(18.0, GlucoseUnit.MGDL)).isWithin(0.01).of(1.0)
|
||||
assertThat(sut.convertToMmol(18.0, GlucoseUnit.MMOL)).isWithin(0.01).of(18.0)
|
||||
assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL)).isWithin(0.01).of(18.0)
|
||||
assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL)).isWithin(0.01).of(1.0)
|
||||
assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MGDL)).isWithin(0.01).of(18.0)
|
||||
assertThat(sut.fromMgdlToUnits(18.0, GlucoseUnit.MMOL)).isWithin(0.01).of(1.0)
|
||||
assertThat(sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MGDL)).isEqualTo("18")
|
||||
assertThat(sut.fromMgdlToStringInUnits(18.0, GlucoseUnit.MMOL).replace(",", ".")).isEqualTo("1.0")
|
||||
assertThat(sut.toTargetRangeString(5.0, 6.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL)).isEqualTo("5 - 6")
|
||||
assertThat(sut.toTargetRangeString(4.0, 4.0, GlucoseUnit.MGDL, GlucoseUnit.MGDL)).isEqualTo("4")
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package info.nightscout.implementation.pump
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.implementation.R
|
||||
import info.nightscout.interfaces.pump.DetailedBolusInfo
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.shared.sharedPreferences.SP
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -47,9 +47,9 @@ class DetailedBolusInfoStorageTest : TestBase() {
|
|||
@Test
|
||||
fun add() {
|
||||
detailedBolusInfoStorage.store.clear()
|
||||
Assertions.assertEquals(0, detailedBolusInfoStorage.store.size)
|
||||
assertThat(detailedBolusInfoStorage.store).isEmpty()
|
||||
detailedBolusInfoStorage.add(info1)
|
||||
Assertions.assertEquals(1, detailedBolusInfoStorage.store.size)
|
||||
assertThat(detailedBolusInfoStorage.store).hasSize(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -58,38 +58,38 @@ class DetailedBolusInfoStorageTest : TestBase() {
|
|||
// Look for exact bolus
|
||||
setUp()
|
||||
var d: DetailedBolusInfo? = detailedBolusInfoStorage.findDetailedBolusInfo(1000000, 4.0)
|
||||
Assertions.assertEquals(4.0, d!!.insulin, 0.01)
|
||||
Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
|
||||
assertThat(d!!.insulin).isWithin(0.01).of(4.0)
|
||||
assertThat(detailedBolusInfoStorage.store).hasSize(2)
|
||||
// Look for exact bolus
|
||||
setUp()
|
||||
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000000, 3.0)
|
||||
Assertions.assertEquals(3.0, d!!.insulin, 0.01)
|
||||
Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
|
||||
assertThat(d!!.insulin).isWithin(0.01).of(3.0)
|
||||
assertThat(detailedBolusInfoStorage.store).hasSize(2)
|
||||
// With less insulin (bolus not delivered completely). Should return first one matching date
|
||||
setUp()
|
||||
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000500, 2.0)
|
||||
Assertions.assertEquals(3.0, d!!.insulin, 0.01)
|
||||
Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
|
||||
assertThat(d!!.insulin).isWithin(0.01).of(3.0)
|
||||
assertThat(detailedBolusInfoStorage.store).hasSize(2)
|
||||
// With less insulin (bolus not delivered completely). Should return first one matching date
|
||||
setUp()
|
||||
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000500, 3.5)
|
||||
Assertions.assertEquals(4.0, d!!.insulin, 0.01)
|
||||
Assertions.assertEquals(2, detailedBolusInfoStorage.store.size)
|
||||
assertThat(d!!.insulin).isWithin(0.01).of(4.0)
|
||||
assertThat(detailedBolusInfoStorage.store).hasSize(2)
|
||||
// With more insulin should return null
|
||||
setUp()
|
||||
d = detailedBolusInfoStorage.findDetailedBolusInfo(1000500, 4.5)
|
||||
Assertions.assertNull(d)
|
||||
Assertions.assertEquals(3, detailedBolusInfoStorage.store.size)
|
||||
assertThat(d).isNull()
|
||||
assertThat(detailedBolusInfoStorage.store).hasSize(3)
|
||||
// With more than one minute off should return null
|
||||
setUp()
|
||||
d = detailedBolusInfoStorage.findDetailedBolusInfo(1070000, 4.0)
|
||||
Assertions.assertNull(d)
|
||||
Assertions.assertEquals(3, detailedBolusInfoStorage.store.size)
|
||||
assertThat(d).isNull()
|
||||
assertThat(detailedBolusInfoStorage.store).hasSize(3)
|
||||
// Use last, if bolus size is the same
|
||||
// setUp()
|
||||
// d = detailedBolusInfoStorage.findDetailedBolusInfo(1070000, 5.0)
|
||||
// assertEquals(5.0, d!!.insulin, 0.01)
|
||||
// assertEquals(2, detailedBolusInfoStorage.store.size)
|
||||
// assertThat( d!!.insulin).isWithin(0.01).of(5.0)
|
||||
// assertThat(detailedBolusInfoStorage.store).hasSize(2)
|
||||
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.implementation.pump
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.interfaces.pump.PumpSync
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
|
@ -29,9 +29,9 @@ class TemporaryBasalStorageTest : TestBase() {
|
|||
@Test
|
||||
fun add() {
|
||||
temporaryBasalStorage.store.clear()
|
||||
Assertions.assertEquals(0, temporaryBasalStorage.store.size)
|
||||
assertThat(temporaryBasalStorage.store).isEmpty()
|
||||
temporaryBasalStorage.add(info1)
|
||||
Assertions.assertEquals(1, temporaryBasalStorage.store.size)
|
||||
assertThat(temporaryBasalStorage.store).hasSize(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -40,38 +40,38 @@ class TemporaryBasalStorageTest : TestBase() {
|
|||
// Look for exact bolus
|
||||
setUp()
|
||||
var d = temporaryBasalStorage.findTemporaryBasal(1000000, 4.0)
|
||||
Assertions.assertEquals(4.0, d!!.rate, 0.01)
|
||||
Assertions.assertEquals(2, temporaryBasalStorage.store.size)
|
||||
assertThat(d!!.rate).isWithin(0.01).of(4.0)
|
||||
assertThat(temporaryBasalStorage.store).hasSize(2)
|
||||
// Look for exact bolus
|
||||
setUp()
|
||||
d = temporaryBasalStorage.findTemporaryBasal(1000000, 3.0)
|
||||
Assertions.assertEquals(3.0, d!!.rate, 0.01)
|
||||
Assertions.assertEquals(2, temporaryBasalStorage.store.size)
|
||||
assertThat(d!!.rate).isWithin(0.01).of(3.0)
|
||||
assertThat(temporaryBasalStorage.store).hasSize(2)
|
||||
// With less rate (bolus not delivered completely). Should return first one matching date
|
||||
setUp()
|
||||
d = temporaryBasalStorage.findTemporaryBasal(1000500, 2.0)
|
||||
Assertions.assertEquals(3.0, d!!.rate, 0.01)
|
||||
Assertions.assertEquals(2, temporaryBasalStorage.store.size)
|
||||
assertThat(d!!.rate).isWithin(0.01).of(3.0)
|
||||
assertThat(temporaryBasalStorage.store).hasSize(2)
|
||||
// With less rate (bolus not delivered completely). Should return first one matching date
|
||||
setUp()
|
||||
d = temporaryBasalStorage.findTemporaryBasal(1000500, 3.5)
|
||||
Assertions.assertEquals(4.0, d!!.rate, 0.01)
|
||||
Assertions.assertEquals(2, temporaryBasalStorage.store.size)
|
||||
assertThat(d!!.rate).isWithin(0.01).of(4.0)
|
||||
assertThat(temporaryBasalStorage.store).hasSize(2)
|
||||
// With more rate should return null
|
||||
setUp()
|
||||
d = temporaryBasalStorage.findTemporaryBasal(1000500, 4.5)
|
||||
Assertions.assertNull(d)
|
||||
Assertions.assertEquals(3, temporaryBasalStorage.store.size)
|
||||
assertThat(d).isNull()
|
||||
assertThat(temporaryBasalStorage.store).hasSize(3)
|
||||
// With more than one minute off should return null
|
||||
setUp()
|
||||
d = temporaryBasalStorage.findTemporaryBasal(1070000, 4.0)
|
||||
Assertions.assertNull(d)
|
||||
Assertions.assertEquals(3, temporaryBasalStorage.store.size)
|
||||
assertThat(d).isNull()
|
||||
assertThat(temporaryBasalStorage.store).hasSize(3)
|
||||
// Use last, if bolus size is the same
|
||||
setUp()
|
||||
d = temporaryBasalStorage.findTemporaryBasal(1070000, 5.0)
|
||||
Assertions.assertEquals(5.0, d!!.rate, 0.01)
|
||||
Assertions.assertEquals(2, temporaryBasalStorage.store.size)
|
||||
assertThat(d!!.rate).isWithin(0.01).of(5.0)
|
||||
assertThat(temporaryBasalStorage.store).hasSize(2)
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.implementation.queue
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.PowerManager
|
||||
|
@ -38,7 +39,6 @@ import info.nightscout.shared.utils.DateUtil
|
|||
import info.nightscout.sharedtests.TestBaseWithProfile
|
||||
import info.nightscout.sharedtests.TestPumpPlugin
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -169,121 +169,121 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
commandQueue.handler = handler
|
||||
|
||||
// start with empty queue
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// add bolus command
|
||||
commandQueue.bolus(DetailedBolusInfo(), null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
|
||||
commandQueue.waitForFinishedThread()
|
||||
Thread.sleep(1000)
|
||||
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun doTests() {
|
||||
|
||||
// start with empty queue
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// add bolus command
|
||||
commandQueue.bolus(DetailedBolusInfo(), null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
|
||||
// add READSTATUS
|
||||
commandQueue.readStatus("anyString", null)
|
||||
Assertions.assertEquals(2, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(2)
|
||||
|
||||
// adding another bolus should remove the first one (size still == 2)
|
||||
commandQueue.bolus(DetailedBolusInfo(), null)
|
||||
Assertions.assertEquals(2, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(2)
|
||||
|
||||
// clear the queue should reset size
|
||||
commandQueue.clear()
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// add tempbasal
|
||||
commandQueue.tempBasalAbsolute(0.0, 30, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
|
||||
// add tempbasal percent. it should replace previous TEMPBASAL
|
||||
commandQueue.tempBasalPercent(0, 30, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
|
||||
// cancel tempbasal it should replace previous TEMPBASAL
|
||||
commandQueue.cancelTempBasal(false, null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
|
||||
// add extended bolus
|
||||
commandQueue.extendedBolus(1.0, 30, null)
|
||||
Assertions.assertEquals(2, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(2)
|
||||
|
||||
// add extended should remove previous extended setting
|
||||
commandQueue.extendedBolus(1.0, 30, null)
|
||||
Assertions.assertEquals(2, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(2)
|
||||
|
||||
// cancel extended bolus should replace previous extended
|
||||
commandQueue.cancelExtended(null)
|
||||
Assertions.assertEquals(2, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(2)
|
||||
|
||||
// add setProfile
|
||||
// TODO: this crash the test
|
||||
// commandQueue.setProfile(validProfile, null)
|
||||
// Assertions.assertEquals(3, commandQueue.size())
|
||||
// assertThat(commandQueue.size()).isEqualTo(3)
|
||||
|
||||
// add loadHistory
|
||||
commandQueue.loadHistory(0.toByte(), null)
|
||||
Assertions.assertEquals(3, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(3)
|
||||
|
||||
// add loadEvents
|
||||
commandQueue.loadEvents(null)
|
||||
Assertions.assertEquals(4, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(4)
|
||||
|
||||
// add clearAlarms
|
||||
commandQueue.clearAlarms(null)
|
||||
Assertions.assertEquals(5, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(5)
|
||||
|
||||
// add deactivate
|
||||
commandQueue.deactivate(null)
|
||||
Assertions.assertEquals(6, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(6)
|
||||
|
||||
// add updateTime
|
||||
commandQueue.updateTime(null)
|
||||
Assertions.assertEquals(7, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(7)
|
||||
|
||||
commandQueue.clear()
|
||||
commandQueue.tempBasalAbsolute(0.0, 30, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
|
||||
commandQueue.pickup()
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
Assertions.assertNotNull(commandQueue.performing)
|
||||
Assertions.assertEquals(Command.CommandType.TEMPBASAL, commandQueue.performing?.commandType)
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
assertThat(commandQueue.performing).isNotNull()
|
||||
assertThat(commandQueue.performing?.commandType).isEqualTo(Command.CommandType.TEMPBASAL)
|
||||
commandQueue.resetPerforming()
|
||||
Assertions.assertNull(commandQueue.performing)
|
||||
assertThat(commandQueue.performing).isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun callingCancelAllBolusesClearsQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
val smb = DetailedBolusInfo()
|
||||
smb.lastKnownBolusTime = System.currentTimeMillis()
|
||||
smb.bolusType = DetailedBolusInfo.BolusType.SMB
|
||||
commandQueue.bolus(smb, null)
|
||||
commandQueue.bolus(DetailedBolusInfo(), null)
|
||||
Assertions.assertEquals(2, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(2)
|
||||
|
||||
// when
|
||||
commandQueue.cancelAllBoluses(null)
|
||||
|
||||
// then
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun smbIsRejectedIfABolusIsQueued() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.bolus(DetailedBolusInfo(), null)
|
||||
|
@ -292,14 +292,14 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
val queued: Boolean = commandQueue.bolus(smb, null)
|
||||
|
||||
// then
|
||||
Assertions.assertFalse(queued)
|
||||
Assertions.assertEquals(commandQueue.size(), 1)
|
||||
assertThat(queued).isFalse()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun smbIsRejectedIfLastKnownBolusIsOutdated() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
val bolus = DetailedBolusInfo()
|
||||
|
@ -308,14 +308,14 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
val queued: Boolean = commandQueue.bolus(bolus, null)
|
||||
|
||||
// then
|
||||
Assertions.assertFalse(queued)
|
||||
Assertions.assertEquals(commandQueue.size(), 0)
|
||||
assertThat(queued).isFalse()
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isCustomCommandRunning() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
val queued1 = commandQueue.customCommand(CustomCommand1(), null)
|
||||
|
@ -323,249 +323,249 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
|
|||
commandQueue.pickup()
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(queued1)
|
||||
Assertions.assertTrue(queued2)
|
||||
Assertions.assertTrue(commandQueue.isCustomCommandInQueue(CustomCommand1::class.java))
|
||||
Assertions.assertTrue(commandQueue.isCustomCommandInQueue(CustomCommand2::class.java))
|
||||
Assertions.assertFalse(commandQueue.isCustomCommandInQueue(CustomCommand3::class.java))
|
||||
assertThat(queued1).isTrue()
|
||||
assertThat(queued2).isTrue()
|
||||
assertThat(commandQueue.isCustomCommandInQueue(CustomCommand1::class.java)).isTrue()
|
||||
assertThat(commandQueue.isCustomCommandInQueue(CustomCommand2::class.java)).isTrue()
|
||||
assertThat(commandQueue.isCustomCommandInQueue(CustomCommand3::class.java)).isFalse()
|
||||
|
||||
Assertions.assertTrue(commandQueue.isCustomCommandRunning(CustomCommand1::class.java))
|
||||
Assertions.assertFalse(commandQueue.isCustomCommandRunning(CustomCommand2::class.java))
|
||||
Assertions.assertFalse(commandQueue.isCustomCommandRunning(CustomCommand3::class.java))
|
||||
assertThat(commandQueue.isCustomCommandRunning(CustomCommand1::class.java)).isTrue()
|
||||
assertThat(commandQueue.isCustomCommandRunning(CustomCommand2::class.java)).isFalse()
|
||||
assertThat(commandQueue.isCustomCommandRunning(CustomCommand3::class.java)).isFalse()
|
||||
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isSetUserOptionsCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.setUserOptions(null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.SET_USER_SETTINGS))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.SET_USER_SETTINGS)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.setUserOptions(null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isLoadEventsCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.loadEvents(null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.LOAD_EVENTS))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.LOAD_EVENTS)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.loadEvents(null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isClearAlarmsCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.clearAlarms(null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.CLEAR_ALARMS))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.CLEAR_ALARMS)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.clearAlarms(null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isDeactivateCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.deactivate(null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.DEACTIVATE))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.DEACTIVATE)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.deactivate(null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isUpdateTimeCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.updateTime(null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.UPDATE_TIME))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.UPDATE_TIME)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.updateTime(null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isLoadTDDsCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.loadTDDs(null)
|
||||
|
||||
// then
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.loadTDDs(null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isLoadHistoryCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.loadHistory(0, null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.LOAD_HISTORY))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.LOAD_HISTORY)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.loadHistory(0, null)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isProfileSetCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
testPumpPlugin.isProfileSet = true
|
||||
commandQueue.setProfile(validProfile, false, object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
Assertions.assertFalse(result.enacted)
|
||||
assertThat(result.success).isTrue()
|
||||
assertThat(result.enacted).isFalse()
|
||||
}
|
||||
})
|
||||
|
||||
// then
|
||||
// the same profile -> ignore
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
// different should be added
|
||||
testPumpPlugin.isProfileSet = false
|
||||
commandQueue.setProfile(validProfile, false, object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
Assertions.assertTrue(result.enacted)
|
||||
assertThat(result.success).isTrue()
|
||||
assertThat(result.enacted).isTrue()
|
||||
}
|
||||
})
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
// next should be ignored
|
||||
commandQueue.setProfile(validProfile, false, object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
testPumpPlugin.isProfileSet = true
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isStopCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.stopPump(null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.STOP_PUMP))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.STOP_PUMP)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isStarCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.startPump(null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.START_PUMP))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.START_PUMP)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun isSetTbrNotificationCommandInQueue() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
commandQueue.setTBROverNotification(null, true)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(commandQueue.isLastScheduled(Command.CommandType.INSIGHT_SET_TBR_OVER_ALARM))
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(commandQueue.isLastScheduled(Command.CommandType.INSIGHT_SET_TBR_OVER_ALARM)).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun differentCustomCommandsAllowed() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
val queued1 = commandQueue.customCommand(CustomCommand1(), null)
|
||||
val queued2 = commandQueue.customCommand(CustomCommand2(), null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(queued1)
|
||||
Assertions.assertTrue(queued2)
|
||||
Assertions.assertEquals(2, commandQueue.size())
|
||||
assertThat(queued1).isTrue()
|
||||
assertThat(queued2).isTrue()
|
||||
assertThat(commandQueue.size()).isEqualTo(2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun sameCustomCommandNotAllowed() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
val queued1 = commandQueue.customCommand(CustomCommand1(), null)
|
||||
val queued2 = commandQueue.customCommand(CustomCommand1(), null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(queued1)
|
||||
Assertions.assertFalse(queued2)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
assertThat(queued1).isTrue()
|
||||
assertThat(queued2).isFalse()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun readStatusTwiceIsNotAllowed() {
|
||||
// given
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
|
||||
// when
|
||||
val queued1 = commandQueue.readStatus("1", null)
|
||||
val queued2 = commandQueue.readStatus("2", null)
|
||||
|
||||
// then
|
||||
Assertions.assertTrue(queued1)
|
||||
Assertions.assertFalse(queued2)
|
||||
Assertions.assertEquals(1, commandQueue.size())
|
||||
Assertions.assertTrue(commandQueue.statusInQueue())
|
||||
assertThat(queued1).isTrue()
|
||||
assertThat(queued2).isFalse()
|
||||
assertThat(commandQueue.size()).isEqualTo(1)
|
||||
assertThat(commandQueue.statusInQueue()).isTrue()
|
||||
}
|
||||
|
||||
private class CustomCommand1 : CustomCommand {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.implementation.queue
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import android.content.Context
|
||||
import android.os.PowerManager
|
||||
import dagger.android.AndroidInjector
|
||||
|
@ -16,7 +17,6 @@ import info.nightscout.interfaces.queue.Command
|
|||
import info.nightscout.interfaces.ui.UiInteraction
|
||||
import info.nightscout.sharedtests.TestBaseWithProfile
|
||||
import info.nightscout.sharedtests.TestPumpPlugin
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers
|
||||
|
@ -84,6 +84,6 @@ class QueueThreadTest : TestBaseWithProfile() {
|
|||
commandQueue.tempBasalAbsolute(2.0, 60, true, validProfile, PumpSync.TemporaryBasalType.NORMAL, null)
|
||||
@Suppress("CallToThreadRun")
|
||||
sut.run()
|
||||
Assertions.assertEquals(0, commandQueue.size())
|
||||
assertThat(commandQueue.size()).isEqualTo(0)
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.implementation.utils
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.interfaces.utils.DecimalFormatter
|
||||
import info.nightscout.shared.interfaces.ResourceHelper
|
||||
import info.nightscout.sharedtests.TestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
|
@ -20,22 +20,22 @@ class DecimalFormatterTest : TestBase() {
|
|||
}
|
||||
|
||||
@Test fun to0DecimalTest() {
|
||||
Assertions.assertEquals("1", sut.to0Decimal(1.33).replace(",", "."))
|
||||
Assertions.assertEquals("1U", sut.to0Decimal(1.33, "U").replace(",", "."))
|
||||
assertThat(sut.to0Decimal(1.33).replace(",", ".")).isEqualTo("1")
|
||||
assertThat(sut.to0Decimal(1.33, "U").replace(",", ".")).isEqualTo("1U")
|
||||
}
|
||||
|
||||
@Test fun to1DecimalTest() {
|
||||
Assertions.assertEquals("1.3", sut.to1Decimal(1.33).replace(",", "."))
|
||||
Assertions.assertEquals("1.3U", sut.to1Decimal(1.33, "U").replace(",", "."))
|
||||
assertThat(sut.to1Decimal(1.33).replace(",", ".")).isEqualTo("1.3")
|
||||
assertThat(sut.to1Decimal(1.33, "U").replace(",", ".")).isEqualTo("1.3U")
|
||||
}
|
||||
|
||||
@Test fun to2DecimalTest() {
|
||||
Assertions.assertEquals("1.33", sut.to2Decimal(1.3333).replace(",", "."))
|
||||
Assertions.assertEquals("1.33U", sut.to2Decimal(1.3333, "U").replace(",", "."))
|
||||
assertThat(sut.to2Decimal(1.3333).replace(",", ".")).isEqualTo("1.33")
|
||||
assertThat(sut.to2Decimal(1.3333, "U").replace(",", ".")).isEqualTo("1.33U")
|
||||
}
|
||||
|
||||
@Test fun to3DecimalTest() {
|
||||
Assertions.assertEquals("1.333", sut.to3Decimal(1.3333).replace(",", "."))
|
||||
Assertions.assertEquals("1.333U", sut.to3Decimal(1.3333, "U").replace(",", "."))
|
||||
assertThat(sut.to3Decimal(1.3333).replace(",", ".")).isEqualTo("1.333")
|
||||
assertThat(sut.to3Decimal(1.3333, "U").replace(",", ".")).isEqualTo("1.333U")
|
||||
}
|
||||
}
|
|
@ -114,4 +114,5 @@
|
|||
<string name="loop_smb_set_by_pump_label">SMB défini par la pompe</string>
|
||||
<string name="loop_open_mode_min_change">Changement minimum [%]</string>
|
||||
<string name="loop_open_mode_min_change_summary" formatted="false">Le fonctionnement de la Boucle demandera une confirmation uniquement si le changement est supérieur à cette valeur en %. Par défaut, la valeur est 20%</string>
|
||||
<string name="fallback_smb_no_tdd">Revenir à SMB. Pas assez de données DTQ.</string>
|
||||
</resources>
|
||||
|
|
|
@ -68,8 +68,8 @@
|
|||
<string name="configbuilder_sync">Sincronización</string>
|
||||
<string name="configbuilder_sync_description">Subida de datos y sincronización de plugins</string>
|
||||
<string name="configbuilder_constraints_description">¿Qué restricciones se aplican?</string>
|
||||
<string name="configbuilder_loop">Lazo</string>
|
||||
<string name="configbuilder_loop_description">Usa esto para habilitar la integración de lazo de AAPS</string>
|
||||
<string name="configbuilder_loop">Bucle</string>
|
||||
<string name="configbuilder_loop_description">Usa esto para habilitar la integración de bucle de AAPS.</string>
|
||||
<string name="configbuilder_insulin_description">¿Qué tipo de insulina estás utilizando?</string>
|
||||
<string name="configbuilder_bgsource">Origen de Glucosa</string>
|
||||
<string name="configbuilder_bgsource_description">¿Desde dónde debería obtener AAPS los datos?</string>
|
||||
|
|
|
@ -158,4 +158,14 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
|
|||
<!-- Permissions -->
|
||||
<string name="alert_dialog_storage_permission_text">Veuillez redémarrer votre téléphone ou redémarrer AAPS à partir des Paramètres du système\nsinon AAPS ne sera pas connecté aux journaux (important pour suivre et vérifier que les algorithmes fonctionnent correctement)!</string>
|
||||
<!-- Maintenance -->
|
||||
<string name="metadata_label_format">Format de fichier</string>
|
||||
<string name="metadata_label_created_at">Créé le</string>
|
||||
<string name="metadata_label_aaps_version">Version d\'AAPS</string>
|
||||
<string name="metadata_label_aaps_flavour">Version de construction</string>
|
||||
<string name="metadata_label_device_name">Export du nom du patient de l\'appareil</string>
|
||||
<string name="metadata_label_device_model">Export du modèle de l\'appareil</string>
|
||||
<string name="metadata_label_encryption">Cryptage du fichier</string>
|
||||
<string name="metadata_format_new">Nouveau format chiffré</string>
|
||||
<string name="metadata_format_debug">Nouveau format de débogage (non crypté)</string>
|
||||
<string name="metadata_format_other">Format d\'export inconnu</string>
|
||||
</resources>
|
||||
|
|
|
@ -157,4 +157,14 @@
|
|||
<!-- Permissions -->
|
||||
<string name="alert_dialog_storage_permission_text">Herstart je telefoon of herstart AndroidAPS vanuit de systeem instellingen a. u. b. \nanders zal AndroidAPS geen log mogelijkheid hebben (Dit is belangrijk om te controleren of de algoritmes correct werken)!</string>
|
||||
<!-- Maintenance -->
|
||||
<string name="metadata_label_format">Bestandsformaat</string>
|
||||
<string name="metadata_label_created_at">Gemaakt op</string>
|
||||
<string name="metadata_label_aaps_version">AAPS versie</string>
|
||||
<string name="metadata_label_aaps_flavour">Build variant</string>
|
||||
<string name="metadata_label_device_name">Patiëntnaam van exporterend apparaat</string>
|
||||
<string name="metadata_label_device_model">Modelnaam/nr van exporterend apparaat</string>
|
||||
<string name="metadata_label_encryption">Bestandsversleuteling</string>
|
||||
<string name="metadata_format_new">Nieuwe versleutelde indeling</string>
|
||||
<string name="metadata_format_debug">Nieuwe debug indeling (onversleuteld)</string>
|
||||
<string name="metadata_format_other">Onbekende export indeling</string>
|
||||
</resources>
|
||||
|
|
|
@ -157,4 +157,14 @@
|
|||
<!-- Permissions -->
|
||||
<string name="alert_dialog_storage_permission_text">Vennligst start mobilen på nytt eller restart AAPS fra Innstillinger \nellers vil ikke AAPS ha aktivert loggføring (viktig for å spore og kontrollere at algoritmene fungerer riktig)!</string>
|
||||
<!-- Maintenance -->
|
||||
<string name="metadata_label_format">Filformat</string>
|
||||
<string name="metadata_label_created_at">Opprettet den</string>
|
||||
<string name="metadata_label_aaps_version">AAPS versjon</string>
|
||||
<string name="metadata_label_aaps_flavour">Byggvariant</string>
|
||||
<string name="metadata_label_device_name">Exporterer enhetens pasientnavn</string>
|
||||
<string name="metadata_label_device_model">Eksporterer enhetsmodell</string>
|
||||
<string name="metadata_label_encryption">Filkryptering</string>
|
||||
<string name="metadata_format_new">Nytt krypteringsformat</string>
|
||||
<string name="metadata_format_debug">Nytt feilsøkingsformat (ukryptert)</string>
|
||||
<string name="metadata_format_other">Ukjent eksportformat</string>
|
||||
</resources>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<string name="dia_profile">Debes establecer el valor de DAI en tu perfil.</string>
|
||||
<string name="dia_minimumis5h">El valor mínimo permitido es de 5 horas.</string>
|
||||
<string name="dia_hint1">https://wiki.aaps.app/en/latest/Configuration/Config-Builder.html#insulin</string>
|
||||
<string name="dia_meaningisequaltodiapump">Si usted está satisfecho de que el valor para DIA que utilizó en su bomba antes de que AAPS funcionara bien, no hay necesidad de cambiar esto cuando comience a hacer bucle.</string>
|
||||
<string name="dia_meaningisequaltodiapump">Si usted está satisfecho de que el valor para DIA que utilizó en su bomba antes de que AAPS funcionara bien, no hay necesidad de cambiar esto cuando comience usar el bucle cerrado.</string>
|
||||
<string name="dia_valuemustbedetermined">Deberás determinar por ti mismo el valor apropiado para DAI.</string>
|
||||
<string name="hypott_label">Objetivo temporal ante Hipoglucemia</string>
|
||||
<string name="hypott_whenhypott">¿Cuál es la razón principal para establecer un objetivo temporal por hipoglucemia?</string>
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<!-- Pump History -->
|
||||
<string name="pump_history_type">Tipo:</string>
|
||||
<!-- PumpDeviceState -->
|
||||
<string name="pump_status_never_contacted">Nunca contactado</string>
|
||||
<string name="pump_status_never_contacted">Nunca conectado</string>
|
||||
<string name="pump_status_sleeping">En reposo</string>
|
||||
<string name="pump_status_waking_up">Iniciando</string>
|
||||
<string name="pump_status_active">Activo</string>
|
||||
|
|
|
@ -65,6 +65,14 @@
|
|||
<!-- Pump History -->
|
||||
<string name="pump_history_type">Type :</string>
|
||||
<!-- PumpDeviceState -->
|
||||
<string name="pump_status_never_contacted">Jamais contacté</string>
|
||||
<string name="pump_status_sleeping">En veille</string>
|
||||
<string name="pump_status_waking_up">Réveil en cours</string>
|
||||
<string name="pump_status_active">Actif</string>
|
||||
<string name="pump_status_error_comm">Erreur de communication</string>
|
||||
<string name="pump_status_timeout_comm">Délai de communication dépassé</string>
|
||||
<string name="pump_status_pump_unreachable">Pompe hors de portée</string>
|
||||
<string name="pump_status_invalid_config">Configuration invalide</string>
|
||||
<plurals name="duration_days">
|
||||
<item quantity="one">%1$d jour</item>
|
||||
<item quantity="other">%1$d jours</item>
|
||||
|
|
|
@ -65,6 +65,14 @@
|
|||
<!-- Pump History -->
|
||||
<string name="pump_history_type">Type:</string>
|
||||
<!-- PumpDeviceState -->
|
||||
<string name="pump_status_never_contacted">Nooit verbonden</string>
|
||||
<string name="pump_status_sleeping">Slapend</string>
|
||||
<string name="pump_status_waking_up">Actief worden</string>
|
||||
<string name="pump_status_active">Actief</string>
|
||||
<string name="pump_status_error_comm">Communicatiefout</string>
|
||||
<string name="pump_status_timeout_comm">Time-out bij communicatie</string>
|
||||
<string name="pump_status_pump_unreachable">Pomp niet bereikbaar</string>
|
||||
<string name="pump_status_invalid_config">Ongeldige configuratie</string>
|
||||
<plurals name="duration_days">
|
||||
<item quantity="one">%1$d dag</item>
|
||||
<item quantity="other">%1$d dagen</item>
|
||||
|
|
|
@ -65,6 +65,14 @@
|
|||
<!-- Pump History -->
|
||||
<string name="pump_history_type">Type:</string>
|
||||
<!-- PumpDeviceState -->
|
||||
<string name="pump_status_never_contacted">Aldri tilkoblet</string>
|
||||
<string name="pump_status_sleeping">Hvilemodus</string>
|
||||
<string name="pump_status_waking_up">Våkner opp</string>
|
||||
<string name="pump_status_active">Aktiv</string>
|
||||
<string name="pump_status_error_comm">Feil med kommunikasjon</string>
|
||||
<string name="pump_status_timeout_comm">Tidsavbrudd ved kommunikasjon</string>
|
||||
<string name="pump_status_pump_unreachable">Pumpe er utilgjengelig</string>
|
||||
<string name="pump_status_invalid_config">Ugyldig konfigurasjon</string>
|
||||
<plurals name="duration_days">
|
||||
<item quantity="one">%1$d dag</item>
|
||||
<item quantity="other">%1$d dager</item>
|
||||
|
|
|
@ -65,6 +65,14 @@
|
|||
<!-- Pump History -->
|
||||
<string name="pump_history_type">Typ:</string>
|
||||
<!-- PumpDeviceState -->
|
||||
<string name="pump_status_never_contacted">Nikdy nepripojené</string>
|
||||
<string name="pump_status_sleeping">Spiaca</string>
|
||||
<string name="pump_status_waking_up">Prebúdzanie</string>
|
||||
<string name="pump_status_active">Aktívna</string>
|
||||
<string name="pump_status_error_comm">Chyba komunikácie</string>
|
||||
<string name="pump_status_timeout_comm">Uplynul časový limit komunikácie</string>
|
||||
<string name="pump_status_pump_unreachable">Pumpa nedostupná</string>
|
||||
<string name="pump_status_invalid_config">Neplatná konfigurácia</string>
|
||||
<plurals name="duration_days">
|
||||
<item quantity="one">%1$d deň</item>
|
||||
<item quantity="few">%1$d dní</item>
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
<string name="virtual_pump_label">POMPE VIRTUELLE</string>
|
||||
<string name="virtualpump_settings">Paramètres pompe virtuelle</string>
|
||||
<!-- PumpType-->
|
||||
<string name="def_extended_note">* Uniquement les valeurs unitaires sont acceptées. Les plages pour les basal/bolus ne sont pas supportées par les pompes virtuelles.</string>
|
||||
</resources>
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
<string name="virtual_pump_label">VIRTUELE POMP</string>
|
||||
<string name="virtualpump_settings">Virtuele pomp instellingen</string>
|
||||
<!-- PumpType-->
|
||||
<string name="def_extended_note">* Alleen absolute waardes (geen van-tot bereik) worden ondersteund voor basaal / bolus in virtuele pomp.</string>
|
||||
</resources>
|
||||
|
|
|
@ -9,4 +9,5 @@
|
|||
<string name="virtual_pump_label">VIRTUELL PUMPE</string>
|
||||
<string name="virtualpump_settings">Innstillinger for virtuell pumpe</string>
|
||||
<!-- PumpType-->
|
||||
<string name="def_extended_note">* Bare konkrete verdier støttes som granularitet for basal/bolus i virtuell pumpe, ingen verdiområder.</string>
|
||||
</resources>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.ui.defaultProfile
|
||||
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import info.nightscout.core.profile.ProfileSealed
|
||||
import info.nightscout.interfaces.GlucoseUnit
|
||||
import info.nightscout.sharedtests.TestBaseWithProfile
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class DefaultProfileTest : TestBaseWithProfile() {
|
||||
|
@ -12,18 +12,18 @@ class DefaultProfileTest : TestBaseWithProfile() {
|
|||
fun profile() {
|
||||
val dp = DefaultProfile(dateUtil, profileUtil).profile(5, 5.1 / 0.3, 0.0, GlucoseUnit.MMOL)
|
||||
var p = ProfileSealed.Pure(dp!!)
|
||||
Assertions.assertEquals(0.150, p.getBasalTimeFromMidnight(0), 0.001)
|
||||
Assertions.assertEquals(15.0, p.getIcTimeFromMidnight(0), 0.001)
|
||||
Assertions.assertEquals(11.8, p.getIsfTimeFromMidnight(0), 0.001)
|
||||
assertThat(p.getBasalTimeFromMidnight(0)).isWithin(0.001).of(0.150)
|
||||
assertThat(p.getIcTimeFromMidnight(0)).isWithin(0.001).of(15.0)
|
||||
assertThat(p.getIsfTimeFromMidnight(0)).isWithin(0.001).of(11.8)
|
||||
|
||||
p = ProfileSealed.Pure(DefaultProfile(dateUtil, profileUtil).profile(7, 10.0 / 0.4, 0.0, GlucoseUnit.MMOL)!!)
|
||||
Assertions.assertEquals(0.350, p.getBasalTimeFromMidnight(0), 0.001)
|
||||
Assertions.assertEquals(15.0, p.getIcTimeFromMidnight(0), 0.001)
|
||||
Assertions.assertEquals(6.8, p.getIsfTimeFromMidnight(0), 0.001)
|
||||
assertThat(p.getBasalTimeFromMidnight(0)).isWithin(0.001).of(0.350)
|
||||
assertThat(p.getIcTimeFromMidnight(0)).isWithin(0.001).of(15.0)
|
||||
assertThat(p.getIsfTimeFromMidnight(0)).isWithin(0.001).of(6.8)
|
||||
|
||||
p = ProfileSealed.Pure(DefaultProfile(dateUtil, profileUtil).profile(12, 25.0 / 0.5, 0.0, GlucoseUnit.MMOL)!!)
|
||||
Assertions.assertEquals(0.80, p.getBasalTimeFromMidnight(0), 0.001)
|
||||
Assertions.assertEquals(10.0, p.getIcTimeFromMidnight(0), 0.001)
|
||||
Assertions.assertEquals(2.2, p.getIsfTimeFromMidnight(0), 0.001)
|
||||
assertThat(p.getBasalTimeFromMidnight(0)).isWithin(0.001).of(0.80)
|
||||
assertThat(p.getIcTimeFromMidnight(0)).isWithin(0.001).of(10.0)
|
||||
assertThat(p.getIsfTimeFromMidnight(0)).isWithin(0.001).of(2.2)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue