From 85104c3c9dd830fb29052c955b940abc5c067288 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 29 Nov 2020 11:56:24 +0100 Subject: [PATCH] fix tests --- .../plugins/insulin/InsulinOrefBasePlugin.kt | 4 ---- .../plugins/insulin/InsulinOrefBasePluginTest.kt | 11 ++++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt index b074900398..1e90792d25 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePlugin.kt @@ -63,10 +63,6 @@ abstract class InsulinOrefBasePlugin( return profile?.dia ?: MIN_DIA } - fun iobCalcForTreatment(treatment: Treatment, time: Long): Iob { - return this.iobCalcForTreatment(treatment, time, 0.0) - } - override fun iobCalcForTreatment(treatment: Treatment, time: Long, dia: Double): Iob { val result = Iob() val peak = peak diff --git a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt index 8c94878dbb..6558ed80be 100644 --- a/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt +++ b/app/src/test/java/info/nightscout/androidaps/plugins/insulin/InsulinOrefBasePluginTest.kt @@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.insulin import dagger.android.AndroidInjector import dagger.android.HasAndroidInjector +import info.nightscout.androidaps.Constants import info.nightscout.androidaps.data.Iob import info.nightscout.androidaps.interfaces.ActivePluginProvider import info.nightscout.androidaps.logging.AAPSLogger @@ -108,22 +109,22 @@ class InsulinOrefBasePluginTest { // check directly after bolus treatment.date = time treatment.insulin = 10.0 - Assert.assertEquals(10.0, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(10.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 1 hour treatment.date = time - 1 * 60 * 60 * 1000 // 1 hour treatment.insulin = 10.0 - Assert.assertEquals(3.92, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(3.92, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 2 hour treatment.date = time - 2 * 60 * 60 * 1000 // 1 hour treatment.insulin = 10.0 - Assert.assertEquals(0.77, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(0.77, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after 3 hour treatment.date = time - 3 * 60 * 60 * 1000 // 1 hour treatment.insulin = 10.0 - Assert.assertEquals(0.10, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(0.10, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) // check after dia treatment.date = time - 4 * 60 * 60 * 1000 treatment.insulin = 10.0 - Assert.assertEquals(0.0, sut.iobCalcForTreatment(treatment, time).iobContrib, 0.1) + Assert.assertEquals(0.0, sut.iobCalcForTreatment(treatment, time, Constants.defaultDIA).iobContrib, 0.1) } } \ No newline at end of file