Commit f9286b7
authored
Assert filterDateRange input is sorted ascending (#38)
The binary-search filterDateRange overload assumes its collection is sorted
ascending by startDate, but returns silently-wrong results otherwise. Add a
debug-only assert enforcing that contract (compiled out of release builds, so
no runtime cost).
This immediately surfaced an existing violation: testGlucoseEffectFromHistory
built a `basal` schedule with segments out of order (and one with endDate
before startDate, plus overlaps). Replace it with a well-formed sorted,
contiguous, non-overlapping schedule, and regenerate the expected-effect
fixture to match the corrected schedule.1 parent 925e672 commit f9286b7
3 files changed
Lines changed: 114 additions & 107 deletions
File tree
- Sources/LoopAlgorithm
- Tests/LoopAlgorithmTests
- Fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
| |||
0 commit comments