feat(cpu): 根据核心数量自适应排列进度条
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import SwiftUI
|
||||
|
||||
@main struct CPUCoreGridChecks {
|
||||
static func main() {
|
||||
for count in 0...128 {
|
||||
for width in [120.0, 280.0, 430.0, 800.0] {
|
||||
let rows = CPUCoreGridLayout.rowCounts(count: count, width: width)
|
||||
precondition(rows.reduce(0, +) == count && rows.count <= 3)
|
||||
if let first = rows.first, let last = rows.last {
|
||||
precondition(last > 0 && first - last <= 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 430) == [9, 9])
|
||||
precondition(CPUCoreGridLayout.rowCounts(count: 18, width: 280) == [6, 6, 6])
|
||||
precondition(CPUCoreGridLayout.rowCounts(count: 32, width: 430) == [11, 11, 10])
|
||||
print("PASS: balanced core rows at multiple widths and counts")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user