perf(efficiency): 落实首批采样减负与发行包瘦身
This commit is contained in:
@@ -10,22 +10,7 @@ import Foundation
|
||||
precondition(CPUTemperatureMonitor.decodeSensorNumber(type: 0, bytes: []) == nil)
|
||||
precondition(FanMetrics.validRPM(0) == 0)
|
||||
for value in [Double.nan, .infinity, -1, 30_001] { precondition(FanMetrics.validRPM(value) == nil) }
|
||||
precondition(FanRotation.speed(rpm: 0, reducedMotion: false) == 0)
|
||||
precondition(FanRotation.speed(rpm: nil, reducedMotion: false) == 0)
|
||||
precondition(FanRotation.speed(rpm: .nan, reducedMotion: false) == 0)
|
||||
precondition(FanRotation.speed(rpm: 6000, reducedMotion: true) == 0)
|
||||
let tiers = [1000.0, 3000, 5000, 7000].map { FanRotation.speed(rpm: $0, reducedMotion: false) }
|
||||
precondition(zip(tiers, tiers.dropFirst()).allSatisfy { $0 < $1 })
|
||||
var rotation = FanRotation()
|
||||
rotation.update(rpm: 1000, reducedMotion: false, at: 100)
|
||||
let before = rotation.angle(at: 101)
|
||||
rotation.update(rpm: 7000, reducedMotion: false, at: 101)
|
||||
precondition(rotation.angle(at: 101) == before)
|
||||
rotation.update(rpm: 0, reducedMotion: false, at: 102)
|
||||
precondition(rotation.angle(at: 102) == rotation.angle(at: 200))
|
||||
rotation.update(rpm: 7000, reducedMotion: true, at: 200)
|
||||
precondition(rotation.angle(at: 200) == rotation.angle(at: 300))
|
||||
print("PASS: fan decoding, invalid RPM, speed tiers, continuous phase and stop/reduced-motion")
|
||||
print("PASS: fan decoding, invalid RPM and static indicator data")
|
||||
print("Live fan RPM:", CPUTemperatureMonitor().sampleFans() as Any)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user