Просмотр исходного кода

Remove original isSmbEnabled function

Sam King 9 месяцев назад
Родитель
Сommit
24a0630341

+ 0 - 4
Trio.xcodeproj/project.pbxproj

@@ -649,7 +649,6 @@
 		DD30B9CA2E062A3400DA677C /* ForecastGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD30B9C92E062A3300DA677C /* ForecastGenerator.swift */; };
 		DD30B9CC2E062A7000DA677C /* ForecastResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD30B9CB2E062A7000DA677C /* ForecastResult.swift */; };
 		DD30B9CE2E062AA300DA677C /* ForecastGenerator+Forecasts.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD30B9CD2E062AA300DA677C /* ForecastGenerator+Forecasts.swift */; };
-		DD30B9FE2E0742E200DA677C /* DetermineBasalSMBEnablementTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD30B9FD2E0742E200DA677C /* DetermineBasalSMBEnablementTests.swift */; };
 		DD30BA002E0745C400DA677C /* DetermineBasalDeltaCalculationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD30B9FF2E0745C400DA677C /* DetermineBasalDeltaCalculationTests.swift */; };
 		DD30BA022E074F0F00DA677C /* GlucoseStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD30BA012E074F0F00DA677C /* GlucoseStatus.swift */; };
 		DD30BA062E07667000DA677C /* DetermineBasal+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD30BA052E07667000DA677C /* DetermineBasal+Helpers.swift */; };
@@ -1580,7 +1579,6 @@
 		DD30B9C92E062A3300DA677C /* ForecastGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForecastGenerator.swift; sourceTree = "<group>"; };
 		DD30B9CB2E062A7000DA677C /* ForecastResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ForecastResult.swift; sourceTree = "<group>"; };
 		DD30B9CD2E062AA300DA677C /* ForecastGenerator+Forecasts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ForecastGenerator+Forecasts.swift"; sourceTree = "<group>"; };
-		DD30B9FD2E0742E200DA677C /* DetermineBasalSMBEnablementTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetermineBasalSMBEnablementTests.swift; sourceTree = "<group>"; };
 		DD30B9FF2E0745C400DA677C /* DetermineBasalDeltaCalculationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetermineBasalDeltaCalculationTests.swift; sourceTree = "<group>"; };
 		DD30BA012E074F0F00DA677C /* GlucoseStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlucoseStatus.swift; sourceTree = "<group>"; };
 		DD30BA052E07667000DA677C /* DetermineBasal+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DetermineBasal+Helpers.swift"; sourceTree = "<group>"; };
@@ -2937,7 +2935,6 @@
 				DD30B9FF2E0745C400DA677C /* DetermineBasalDeltaCalculationTests.swift */,
 				3BAC929A2E55FF4F00B853DA /* DetermineBasalEnableSmbTests.swift */,
 				3BE9F0BA2E28C993001B14EB /* DetermineBasalJsonTests.swift */,
-				DD30B9FD2E0742E200DA677C /* DetermineBasalSMBEnablementTests.swift */,
 				3B2A3BC22E2B19F700658FB9 /* DynamicISFTests.swift */,
 				3B1C5C352D68E269004E9273 /* IobCalculateTests.swift */,
 				3B2CE68A2E24ADF3005EF782 /* IobGenerateTests.swift */,
@@ -5211,7 +5208,6 @@
 				3BF8D14B2D530397001B3F84 /* JSONCompareTests.swift in Sources */,
 				3BEF6AB32D97316F0076089D /* MealTotalTests.swift in Sources */,
 				3BF8D0C12D5175BE001B3F84 /* ProfileJsNativeCompareTests.swift in Sources */,
-				DD30B9FE2E0742E200DA677C /* DetermineBasalSMBEnablementTests.swift in Sources */,
 				3BEF6AB12D9731660076089D /* MealHistoryTests.swift in Sources */,
 				BD8FC0572D66188700B95AED /* PumpHistoryStorageTests.swift in Sources */,
 				BD8FC0642D6619EF00B95AED /* TempTargetStorageTests.swift in Sources */,

+ 0 - 112
Trio/Sources/APS/OpenAPSSwift/DetermineBasal/DetermineBasal+Helpers.swift

@@ -118,118 +118,6 @@ extension DeterminationGenerator {
         return (glucoseImpact + (delta / fiveMinuteBlocks)).jsRounded(scale: 1)
     }
 
-    /// Determines whether SMBs are enabled based on profile settings,
-    /// computed meal data, CGM conditions, and any active overrides.
-    ///
-    /// Mirrors the JavaScript oref's `enable_smb()` logic.
-    ///
-    /// - Parameters:
-    ///   - glucose: The latest blood glucose reading.
-    ///   - profile: The user profile containing SMB preferences and temp-target flags.
-    ///   - autosens: The autosens data (not used in this logic).
-    ///   - mealData: Computed carbs-on-board and related meal information.
-    ///   - override: An optional override controlling SMB scheduling and hard-off flags.
-    ///   - shouldProtectDueToHIGH: `true` if CGM indicates a HIGH reading requiring SMB disable.
-    ///   - currentTime: The current system time for scheduled-off evaluation.
-    /// - Returns: `true` if SMBs should be enabled, `false` otherwise.
-    static func isSMBEnabled(
-        glucose: BloodGlucose,
-        profile: Profile,
-        autosens _: Autosens,
-        mealData: ComputedCarbs?,
-        override: Override?,
-        shouldProtectDueToHIGH: Bool,
-        currentTime: Date
-    ) -> Bool {
-        if let override = override {
-            if override.smbIsScheduledOff {
-                let startHour = override.start
-                let endHour = override.end
-                let hour = Calendar.current.component(.hour, from: currentTime)
-
-                // disable SMB during the scheduled-off window [start, end)
-                if startHour < endHour {
-                    if hour >= Int(startHour), hour < Int(endHour) {
-                        return false
-                    }
-                }
-                // disable SMB if window wraps midnight
-                else if startHour > endHour {
-                    if hour >= Int(startHour) || hour < Int(endHour) {
-                        return false
-                    }
-                }
-                // special cases: off all day or single-hour off
-                else {
-                    if startHour == 0, endHour == 0 {
-                        return false
-                    }
-                    if hour == Int(startHour) {
-                        return false
-                    }
-                }
-            } else if override.smbIsOff {
-                // hard-off override disables SMB entirely
-                return false
-            }
-        }
-
-        if let hasActiveTempTarget = profile.temptargetSet, hasActiveTempTarget {
-            // disable SMB when a high temp target is active and not allowed
-            if !profile.allowSMBWithHighTemptarget,
-               let targetGlucose = profile.targetBg,
-               targetGlucose > 100
-            {
-                return false
-            }
-
-            // enable SMB when a low temp target is active
-            if profile.enableSMBWithTemptarget,
-               let targetGlucose = profile.targetBg,
-               targetGlucose < 100
-            {
-                return true
-            }
-        }
-
-        // disable SMB for invalid CGM readings (HIGH)
-        if shouldProtectDueToHIGH {
-            return false
-        }
-
-        // enable SMB unconditionally if always-on preference is set
-        if profile.enableSMBAlways {
-            return true
-        }
-
-        // enable SMB when carbs-on-board (COB) exists
-        if profile.enableSMBWithCOB,
-           let cob = mealData?.mealCOB,
-           cob > 0
-        {
-            return true
-        }
-
-        // enable SMB for the full post-carb window
-        if profile.enableSMBAfterCarbs,
-           let carbs = mealData?.carbs,
-           carbs > 0
-        {
-            return true
-        }
-
-        // enable SMB when BG exceeds the high-BG threshold
-        if profile.enableSMBHighBg,
-           let glucoseVal = glucose.glucose ?? glucose.sgv,
-           glucoseVal >= Int(profile.enableSMBHighBgTarget)
-        {
-            return true
-        }
-
-        // no enable condition met → disable SMB
-        return false
-    }
-
     static func calculateSensitivityRatio(
         currentGlucose: Decimal,
         profile: Profile,

+ 19 - 19
TrioTests/OpenAPSSwiftTests/DetermineBasalEnableSmbTests.swift

@@ -87,7 +87,7 @@ import Testing
 
     // MARK: - Disabling Conditions
 
-    @Test("Should return false by default with no enabling preferences")  func defaultIsFalse() throws {
+    @Test("Should return false by default with no enabling preferences") func defaultIsFalse() throws {
         let inputs = createDefaultInputs()
         let decision = try DosingEngine.shouldEnableSmb(
             profile: inputs.profile, meal: inputs.meal, currentGlucose: inputs.currentGlucose,
@@ -99,7 +99,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Should disable SMB when smbIsOff is true")  func disableWhenSmbIsOff() throws {
+    @Test("Should disable SMB when smbIsOff is true") func disableWhenSmbIsOff() throws {
         var inputs = createDefaultInputs()
         inputs.trioCustomOrefVariables.smbIsOff = true
         inputs.profile.enableSMBAlways = true // Ensure smbIsOff takes precedence
@@ -114,7 +114,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Should disable SMB when shouldProtectDueToHIGH is true")  func disableWhenProtectDueToHigh() throws {
+    @Test("Should disable SMB when shouldProtectDueToHIGH is true") func disableWhenProtectDueToHigh() throws {
         var inputs = createDefaultInputs()
         inputs.trioCustomOrefVariables.shouldProtectDueToHIGH = true
         inputs.profile.enableSMBAlways = true // Ensure protection takes precedence
@@ -129,7 +129,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Should disable SMB with high temp target when not allowed")  func disableWithHighTempTarget() throws {
+    @Test("Should disable SMB with high temp target when not allowed") func disableWithHighTempTarget() throws {
         var inputs = createDefaultInputs()
         inputs.profile.allowSMBWithHighTemptarget = false
         inputs.profile.temptargetSet = true
@@ -145,7 +145,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Should disable SMB when minGuardGlucose is below threshold")  func disableWhenMinGuardBelowThreshold() throws {
+    @Test("Should disable SMB when minGuardGlucose is below threshold") func disableWhenMinGuardBelowThreshold() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true // Enable SMB initially to test the safety override
         inputs.minGuardGlucose = 65
@@ -164,7 +164,7 @@ import Testing
         #expect(decision.insulinForManualBolus != nil)
     }
 
-    @Test("Should disable SMB when maxDelta is too high")  func disableWhenMaxDeltaTooHigh() throws {
+    @Test("Should disable SMB when maxDelta is too high") func disableWhenMaxDeltaTooHigh() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true // Enable SMB initially
         inputs.profile.maxDeltaBgThreshold = 0.2
@@ -194,7 +194,7 @@ import Testing
 
     // MARK: - Enabling Conditions
 
-    @Test("Should enable SMB when enableSMBAlways is true")  func enableWhenAlwaysOn() throws {
+    @Test("Should enable SMB when enableSMBAlways is true") func enableWhenAlwaysOn() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
 
@@ -208,7 +208,7 @@ import Testing
         #expect(decision.isEnabled == true)
     }
 
-    @Test("Should enable SMB with COB")  func enableWithCob() throws {
+    @Test("Should enable SMB with COB") func enableWithCob() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBWithCOB = true
         inputs.meal = ComputedCarbs(
@@ -233,7 +233,7 @@ import Testing
         #expect(decision.isEnabled == true)
     }
 
-    @Test("Should enable SMB after carbs")  func enableAfterCarbs() throws {
+    @Test("Should enable SMB after carbs") func enableAfterCarbs() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAfterCarbs = true
         inputs.meal = ComputedCarbs(
@@ -258,7 +258,7 @@ import Testing
         #expect(decision.isEnabled == true)
     }
 
-    @Test("Should enable SMB with low temp target")  func enableWithLowTempTarget() throws {
+    @Test("Should enable SMB with low temp target") func enableWithLowTempTarget() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBWithTemptarget = true
         inputs.profile.temptargetSet = true
@@ -274,7 +274,7 @@ import Testing
         #expect(decision.isEnabled == true)
     }
 
-    @Test("Should enable SMB for high BG")  func enableWithHighBg() throws {
+    @Test("Should enable SMB for high BG") func enableWithHighBg() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBHighBg = true
         inputs.profile.enableSMBHighBgTarget = 140
@@ -292,7 +292,7 @@ import Testing
 
     // MARK: - Scheduled Off Tests
 
-    @Test("Scheduled Off (Normal): should disable SMB inside the window")  func scheduledOffNormal_Inside() throws {
+    @Test("Scheduled Off (Normal): should disable SMB inside the window") func scheduledOffNormal_Inside() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true // Ensure schedule is the only reason for failure
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true
@@ -310,7 +310,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Scheduled Off (Normal): should NOT disable SMB outside the window")  func scheduledOffNormal_Outside() throws {
+    @Test("Scheduled Off (Normal): should NOT disable SMB outside the window") func scheduledOffNormal_Outside() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true
@@ -330,7 +330,7 @@ import Testing
 
     @Test(
         "Scheduled Off (Wrapping): should disable SMB inside the window (after midnight)"
-    )  func scheduledOffWrapping_InsideAfterMidnight() throws {
+    ) func scheduledOffWrapping_InsideAfterMidnight() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true
@@ -350,7 +350,7 @@ import Testing
 
     @Test(
         "Scheduled Off (Wrapping): should disable SMB inside the window (before midnight)"
-    )  func scheduledOffWrapping_InsideBeforeMidnight() throws {
+    ) func scheduledOffWrapping_InsideBeforeMidnight() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true
@@ -368,7 +368,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Scheduled Off (Wrapping): should NOT disable SMB outside the window")  func scheduledOffWrapping_Outside() throws {
+    @Test("Scheduled Off (Wrapping): should NOT disable SMB outside the window") func scheduledOffWrapping_Outside() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true
@@ -386,7 +386,7 @@ import Testing
         #expect(decision.isEnabled == true)
     }
 
-    @Test("Scheduled Off (All Day): should disable SMB")  func scheduledOffAllDay() throws {
+    @Test("Scheduled Off (All Day): should disable SMB") func scheduledOffAllDay() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true
@@ -404,7 +404,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Scheduled Off (Single Hour): should disable SMB inside the window")  func scheduledOffSingleHour_Inside() throws {
+    @Test("Scheduled Off (Single Hour): should disable SMB inside the window") func scheduledOffSingleHour_Inside() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true
@@ -422,7 +422,7 @@ import Testing
         #expect(decision.isEnabled == false)
     }
 
-    @Test("Scheduled Off (Single Hour): should NOT disable SMB outside the window")  func scheduledOffSingleHour_Outside() throws {
+    @Test("Scheduled Off (Single Hour): should NOT disable SMB outside the window") func scheduledOffSingleHour_Outside() throws {
         var inputs = createDefaultInputs()
         inputs.profile.enableSMBAlways = true
         inputs.trioCustomOrefVariables.smbIsScheduledOff = true

+ 0 - 259
TrioTests/OpenAPSSwiftTests/DetermineBasalSMBEnablementTests.swift

@@ -1,259 +0,0 @@
-
-import Foundation
-import Testing
-@testable import Trio
-
-@Suite("Determination: SMB Enablement Tests") struct SMBEnablementTests {
-    /// Scheduled-off override window should always disable SMB
-    @Test("should disable SMB during scheduled-off window") func disableDuringScheduledOff() async throws {
-        let now = Calendar.current.date(from: DateComponents(hour: 10))!
-        let override = Override(
-            name: "scheduledOff",
-            enabled: true,
-            date: now,
-            duration: 0,
-            indefinite: false,
-            percentage: 1,
-            smbIsOff: false,
-            isPreset: false,
-            id: "",
-            overrideTarget: false,
-            target: 0,
-            advancedSettings: false,
-            isfAndCr: false,
-            isf: false,
-            cr: false,
-            smbIsScheduledOff: true,
-            start: 9,
-            end: 17,
-            smbMinutes: 0,
-            uamMinutes: 0
-        )
-        var profile = Profile()
-        profile.enableSMBAlways = true
-        let bg = BloodGlucose(
-            sgv: 120,
-            date: Decimal(now.timeIntervalSince1970 * 1000),
-            dateString: now
-        )
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: nil,
-                override: override,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == false
-        )
-    }
-
-    /// A hard-off override should disable SMB immediately
-    @Test("should disable SMB when override.smbIsOff") func disableWhenOverrideOff() async throws {
-        let now = Date()
-        let override = Override(
-            name: "hardOff",
-            enabled: true,
-            date: now,
-            duration: 0,
-            indefinite: false,
-            percentage: 1,
-            smbIsOff: true,
-            isPreset: false,
-            id: "",
-            overrideTarget: false,
-            target: 0,
-            advancedSettings: false,
-            isfAndCr: false,
-            isf: false,
-            cr: false,
-            smbIsScheduledOff: false,
-            start: 0,
-            end: 0,
-            smbMinutes: 0,
-            uamMinutes: 0
-        )
-        let profile = Profile()
-        let bg = BloodGlucose(sgv: 100, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: nil,
-                override: override,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == false
-        )
-    }
-
-    /// Should disable if CGM reports “HIGH” protection
-    @Test("should disable SMB when protectDueToHIGH") func disableWhenProtectDueToHIGH() async throws {
-        let now = Date()
-        let profile = Profile()
-        let bg = BloodGlucose(sgv: 150, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: nil,
-                override: nil,
-                shouldProtectDueToHIGH: true,
-                currentTime: now
-            ) == false
-        )
-    }
-
-    /// Always-on preference should enable SMB
-    @Test("should enable SMB when enableSMBAlways") func enableWhenAlwaysEnabled() async throws {
-        let now = Date()
-        var profile = Profile()
-        profile.enableSMBAlways = true
-        let bg = BloodGlucose(sgv: 80, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: nil,
-                override: nil,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == true
-        )
-    }
-
-    /// Low temp-target below 100 should enable SMB when allowed
-    @Test("should enable SMB with active low temp target") func enableWithActiveLowTempTarget() async throws {
-        let now = Date()
-        var profile = Profile()
-        profile.temptargetSet = true
-        profile.enableSMBWithTemptarget = true
-        profile.targetBg = 90
-        let bg = BloodGlucose(sgv: 95, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: nil,
-                override: nil,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == true
-        )
-    }
-
-    /// High temp-target above 100 should disable SMB when not allowed
-    @Test("should disable SMB with high temp target not allowed") func disableWhenHighTempTargetNotAllowed() async throws {
-        let now = Date()
-        var profile = Profile()
-        profile.temptargetSet = true
-        profile.allowSMBWithHighTemptarget = false
-        profile.targetBg = 120
-        let bg = BloodGlucose(sgv: 115, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: nil,
-                override: nil,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == false
-        )
-    }
-
-    /// Carbs-on-board should enable SMB when COB > 0
-    @Test("should enable SMB with COB") func enableWithCOB() async throws {
-        let now = Date()
-        var profile = Profile()
-        profile.enableSMBWithCOB = true
-        let mealData = ComputedCarbs(
-            carbs: 30,
-            mealCOB: 10,
-            currentDeviation: 0,
-            maxDeviation: 0,
-            minDeviation: 0,
-            slopeFromMaxDeviation: 0,
-            slopeFromMinDeviation: 0,
-            allDeviations: [0],
-            lastCarbTime: now.timeIntervalSince1970
-        )
-        let bg = BloodGlucose(sgv: 100, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: mealData,
-                override: nil,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == true
-        )
-    }
-
-    /// Any carb entry should enable SMB for the after-carbs window
-    @Test("should enable SMB after carbs") func enableAfterCarbs() async throws {
-        let now = Date()
-        var profile = Profile()
-        profile.enableSMBAfterCarbs = true
-        let mealData = ComputedCarbs(
-            carbs: 15,
-            mealCOB: 0,
-            currentDeviation: 0,
-            maxDeviation: 0,
-            minDeviation: 0,
-            slopeFromMaxDeviation: 0,
-            slopeFromMinDeviation: 0,
-            allDeviations: [0],
-            lastCarbTime: now.timeIntervalSince1970
-        )
-        let bg = BloodGlucose(sgv: 90, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: mealData,
-                override: nil,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == true
-        )
-    }
-
-    /// High-BG condition should enable SMB when above threshold
-    @Test("should enable SMB for high BG") func enableWithHighBG() async throws {
-        let now = Date()
-        var profile = Profile()
-        profile.enableSMBHighBg = true
-        profile.enableSMBHighBgTarget = 130
-        let bg = BloodGlucose(sgv: 135, date: Decimal(now.timeIntervalSince1970 * 1000), dateString: now)
-        let autosens = Autosens(ratio: 1, newisf: nil)
-        #expect(
-            DeterminationGenerator.isSMBEnabled(
-                glucose: bg,
-                profile: profile,
-                autosens: autosens,
-                mealData: nil,
-                override: nil,
-                shouldProtectDueToHIGH: false,
-                currentTime: now
-            ) == true
-        )
-    }
-}