feat(ui): 实现全卡堆叠趋势与单页资源进程布局
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import Foundation
|
||||
|
||||
@main struct StackedSeriesChecks {
|
||||
static func main() {
|
||||
let components: [[Double?]] = [[0.2,0,nil,0.4,Double.nan,-0.1], [0.3,0,0.1,0.2,0.1,0.2]]
|
||||
let bands = StackedSeries.bands(components, count: 6, limit: 1)
|
||||
precondition(bands[0].lower[0] == 0 && bands[0].upper[0] == 0.2)
|
||||
precondition(bands[1].lower[0] == 0.2 && bands[1].upper[0] == 0.5)
|
||||
precondition(bands[1].upper[1] == 0, "Real zero must remain a measured stack")
|
||||
for index in [2,4,5] {
|
||||
precondition(bands.allSatisfy { $0.lower[index] == nil && $0.upper[index] == nil },
|
||||
"Missing or invalid components must not invent partial totals")
|
||||
}
|
||||
let memory = StackedSeries.bands([[22,24], [3,4], [1,2]], count: 2, limit: 48)
|
||||
precondition(memory[2].lower == [25,28] && memory[2].upper == [26,30])
|
||||
let gpu = StackedSeries.bands([[0,0.7,1], [1,0.3,0]], count: 3, limit: 1)
|
||||
precondition(gpu.last!.upper == [1,1,1])
|
||||
precondition(StackedSeries.bands([[0.8],[0.4]], count: 1, limit: 1).allSatisfy { $0.upper == [nil] })
|
||||
precondition(StackedSeries.bands([[Double.greatestFiniteMagnitude],[Double.greatestFiniteMagnitude]], count: 1).allSatisfy { $0.upper == [nil] })
|
||||
let dates = (0..<4).map { Date(timeIntervalSinceReferenceDate: Double($0 * 2)) }
|
||||
let pair = StackedSeries.bands([[0.2,nil,nil,0.3],[0.3,nil,nil,0.2]], count: 4)
|
||||
let runs = PanelCurveGeometry.runs(dates: dates, values: pair[1].upper, boundaryDates: [dates[2]], lowerValues: pair[1].lower)
|
||||
precondition(runs.count == 2 && runs[0][0].lower == 0.2 && runs[1][0].lower == 0.3)
|
||||
precondition(runs.flatMap { $0 }.map(\.date) == [dates[0],dates[3]])
|
||||
print("PASS: cumulative component boundaries, CPU/memory/GPU sums, zero/missing/invalid/overflow, paired lower boundaries and sampling breaks")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user