|
|
@@ -98,8 +98,11 @@ import Testing
|
|
|
|
|
|
// After 1 hour, we should see partial carb absorption
|
|
|
#expect(result != nil)
|
|
|
- #expect(result?.mealCOB == 12)
|
|
|
- #expect(result?.currentDeviation.isWithin(0.1, of: 3) == true)
|
|
|
+ #expect(result!.mealCOB.isWithin(12 * 0.25, of: 12) == true, "mealCOB: \(result!.mealCOB.description)")
|
|
|
+ #expect(
|
|
|
+ result!.currentDeviation.isWithin(3 * 0.25, of: 0) == true,
|
|
|
+ "currentDeviation: \(result!.currentDeviation.description)"
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
@Test("should return nil when no treatments provided") func emptyObjectWhenNoTreatments() async throws {
|
|
|
@@ -171,9 +174,12 @@ import Testing
|
|
|
)
|
|
|
|
|
|
#expect(result != nil)
|
|
|
- #expect(result?.carbs == 20)
|
|
|
- #expect(result?.currentDeviation.isWithin(0.1, of: 0.67) == true)
|
|
|
- #expect(result?.mealCOB == 14)
|
|
|
+ #expect(result!.carbs == 20)
|
|
|
+ #expect(
|
|
|
+ result!.currentDeviation.isWithin(0.67 * 0.25, of: 0.67) == true,
|
|
|
+ "currentDeviation: \(result!.currentDeviation.description)"
|
|
|
+ )
|
|
|
+ #expect(result!.mealCOB.isWithin(14 * 0.25, of: 14) == true, "mealCOB: \(result!.mealCOB.description)")
|
|
|
}
|
|
|
|
|
|
@Test("should ignore treatments outside the meal window") func ignoreTreatmentsOutsideMealWindow() async throws {
|
|
|
@@ -223,7 +229,10 @@ import Testing
|
|
|
#expect(result != nil)
|
|
|
#expect(result?.carbs == 0)
|
|
|
#expect(result?.mealCOB == 0)
|
|
|
- #expect(result?.currentDeviation.isWithin(0.1, of: 0.67) == true)
|
|
|
+ #expect(
|
|
|
+ result?.currentDeviation.isWithin(0.67 * 0.25, of: 0.67) == true,
|
|
|
+ "currentDeviation: \(result!.currentDeviation.description)"
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
@Test("should respect maxMealAbsorptionTime from profile") func respectMaxMealAbsorptionTime() async throws {
|