This commit is contained in:
Tim Gunn 2020-05-02 14:50:53 +12:00
parent 5c38762178
commit 0bbdca3b4a
No known key found for this signature in database
GPG key ID: C9BC1E9D0D0AED8C

View file

@ -242,4 +242,14 @@ class SafetyPluginTest : TestBaseWithProfile() {
""".trimIndent(), d.getReasons(aapsLogger)) """.trimIndent(), d.getReasons(aapsLogger))
Assert.assertEquals("Safety: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger)) Assert.assertEquals("Safety: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons(aapsLogger))
} }
@Test fun iobShouldBeZero() {
`when`(sp.getString(R.string.key_aps_mode, "open")).thenReturn("lgs")
// Apply IOB limits
var d = Constraint(hardLimits.MAXIOB_LGS)
d = safetyPlugin.applyMaxIOBConstraints(d)
Assert.assertEquals(0.0, d.value()!!)
Assert.assertEquals("Safety: Limiting IOB to 0.0 U because of Low Glucose Suspend", d.getMostLimitedReasons(aapsLogger))
}
} }