fix tests
This commit is contained in:
parent
7bc7388f06
commit
85104c3c9d
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue