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") } }