(Hopefully) fix iob(AMA|SMB)shouldBeLimited tests.
By making sure there is exactly one APS plugin enabled.
This commit is contained in:
parent
b2a60e2fac
commit
eac1d5ffdb
|
@ -223,13 +223,14 @@ public class ConstraintsCheckerTest {
|
|||
// No limit by default
|
||||
when(SP.getDouble(R.string.key_openapsma_max_iob, 1.5d)).thenReturn(1.5d);
|
||||
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
|
||||
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, true);
|
||||
OpenAPSAMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, true);
|
||||
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
|
||||
OpenAPSSMBPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
|
||||
|
||||
// Apply all limits
|
||||
Constraint<Double> d = constraintChecker.getMaxIOBAllowed();
|
||||
Assert.assertEquals(1.5d, d.value());
|
||||
Assert.assertEquals(3, d.getReasonList().size());
|
||||
Assert.assertEquals(d.getReasonList().toString(),2, d.getReasonList().size());
|
||||
Assert.assertEquals("Safety: Limiting IOB to 1.5 U because of max value in preferences", d.getMostLimitedReasons());
|
||||
|
||||
}
|
||||
|
@ -240,11 +241,13 @@ public class ConstraintsCheckerTest {
|
|||
when(SP.getDouble(R.string.key_openapssmb_max_iob, 3d)).thenReturn(3d);
|
||||
when(SP.getString(R.string.key_age, "")).thenReturn("teenage");
|
||||
OpenAPSSMBPlugin.getPlugin().setPluginEnabled(PluginType.APS, true);
|
||||
OpenAPSAMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
|
||||
OpenAPSMAPlugin.getPlugin().setPluginEnabled(PluginType.APS, false);
|
||||
|
||||
// Apply all limits
|
||||
Constraint<Double> d = constraintChecker.getMaxIOBAllowed();
|
||||
Assert.assertEquals(3d, d.value());
|
||||
Assert.assertEquals(4, d.getReasonList().size());
|
||||
Assert.assertEquals(d.getReasonList().toString(), 2, d.getReasonList().size());
|
||||
Assert.assertEquals("Safety: Limiting IOB to 3.0 U because of max value in preferences", d.getMostLimitedReasons());
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue