From 00eb07914f152e7548946b7477545d030f9939ed Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Mon, 20 Jan 2020 20:43:40 +0100 Subject: [PATCH] Add test for safety of future fix for reporting correct insulin delivered amount after cancel bolus --- .../podinfo/PodInfoFaultEventTest.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java b/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java index 4acd7f9ac4..80e5093c18 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java +++ b/app/src/test/java/info/nightscout/androidaps/plugins/pump/omnipod/comm/message/response/podinfo/PodInfoFaultEventTest.java @@ -77,7 +77,7 @@ public class PodInfoFaultEventTest { } @Test - public void testPodInfoFaultEventIsulinNotDelivered() { + public void testPodInfoFaultEventInsulinNotDelivered() { PodInfoFaultEvent podInfoFaultEvent = new PodInfoFaultEvent(ByteUtil.fromHexString("020f0000010200ec6a026803ff026b000028a7082023")); assertEquals(PodProgressStatus.INACTIVE, podInfoFaultEvent.getPodProgressStatus()); @@ -95,4 +95,24 @@ public class PodInfoFaultEventTest { assertEquals(2, podInfoFaultEvent.getReceiverLowGain()); assertEquals(39, podInfoFaultEvent.getRadioRSSI()); } + + @Test + public void testPodInfoFaultEventMaxInsulinNotDelivered() { + PodInfoFaultEvent podInfoFaultEvent = new PodInfoFaultEvent(ByteUtil.fromHexString("020f00ffff0200ec6a026803ff026b000028a7082023")); + + assertEquals(PodProgressStatus.INACTIVE, podInfoFaultEvent.getPodProgressStatus()); + assertEquals(DeliveryStatus.SUSPENDED, podInfoFaultEvent.getDeliveryStatus()); + assertEquals(11.8, podInfoFaultEvent.getTotalInsulinDelivered(), 0.000001); + assertEquals(3276.75, podInfoFaultEvent.getInsulinNotDelivered(), 0.000001); // Insane and will not happen, but this verifies that we convert it to an unsigned int + assertEquals(0x02, podInfoFaultEvent.getPodMessageCounter()); + assertEquals(FaultEventType.OCCLUSION_CHECK_ABOVE_THRESHOLD, podInfoFaultEvent.getFaultEventType()); + assertTrue(Duration.standardMinutes(616).isEqual(podInfoFaultEvent.getFaultEventTime())); + assertNull(podInfoFaultEvent.getReservoirLevel()); + assertEquals(0, podInfoFaultEvent.getUnacknowledgedAlerts().getRawValue()); + assertFalse(podInfoFaultEvent.isFaultAccessingTables()); + assertEquals(LogEventErrorCode.INTERNAL_2_BIT_VARIABLE_SET_AND_MANIPULATED_IN_MAIN_LOOP_ROUTINES_2, podInfoFaultEvent.getLogEventErrorType()); + assertEquals(PodProgressStatus.RUNNING_ABOVE_FIFTY_UNITS, podInfoFaultEvent.getPodProgressStatusAtTimeOfFirstLoggedFaultEvent()); + assertEquals(2, podInfoFaultEvent.getReceiverLowGain()); + assertEquals(39, podInfoFaultEvent.getRadioRSSI()); + } }