فهرست منبع

Remove temp variable + running unit test script

Sam King 1 روز پیش
والد
کامیت
80252e2524
2فایلهای تغییر یافته به همراه3 افزوده شده و 29 حذف شده
  1. 3 4
      Trio/Sources/APS/OpenAPS/OpenAPS.swift
  2. 0 25
      scripts/run_unit_tests.sh

+ 3 - 4
Trio/Sources/APS/OpenAPS/OpenAPS.swift

@@ -164,14 +164,13 @@ final class OpenAPS {
     }
     }
 
 
     private func createSimulatedBolusEvent(simulatedBolusAmount: Decimal) -> PumpHistoryEvent {
     private func createSimulatedBolusEvent(simulatedBolusAmount: Decimal) -> PumpHistoryEvent {
-        // Adding -1s to the current Date ensures oref actually uses the mock entry to calculate iob
-        // and does not guard it away.
-        let oneSecondAgo = Date().addingTimeInterval(-1)
 
 
+        // for the timestamp, subtract 1 second from now to ensure
+        // that the algorithm take this simulated bolus into account
         return PumpHistoryEvent(
         return PumpHistoryEvent(
             id: UUID().uuidString,
             id: UUID().uuidString,
             type: .bolus,
             type: .bolus,
-            timestamp: oneSecondAgo,
+            timestamp: Date().addingTimeInterval(-1),
             amount: simulatedBolusAmount,
             amount: simulatedBolusAmount,
             duration: 0,
             duration: 0,
             isSMB: true,
             isSMB: true,

+ 0 - 25
scripts/run_unit_tests.sh

@@ -1,25 +0,0 @@
-#!/usr/bin/env bash
-#
-# Build and run the Trio unit tests, mirroring the CI workflow (.github unit_tests.yml).
-#
-# Usage:
-#   scripts/run_unit_tests.sh                                  # run every test
-#   scripts/run_unit_tests.sh PumpHistoryNativeConversionTests # run a single suite/class
-#
-# The optional first argument is a test class/@Suite name in TrioTests.
-#
-# See installed runtimes with:  xcrun simctl list runtimes | grep iOS
-set -euo pipefail
-
-# Run from the repo root regardless of the caller's working directory.
-cd "$(dirname "$0")/.."
-
-DEST='platform=iOS Simulator,name=iPhone 17'
-ONLY="${1:+-only-testing:TrioTests/$1}"
-
-xcodebuild test \
-  -workspace Trio.xcworkspace \
-  -scheme "Trio Tests" \
-  -destination "$DEST" \
-  $ONLY \
-  2>&1 | tee xcodebuild.log