12 lines
566 B
Swift
12 lines
566 B
Swift
import Foundation
|
|
@main struct Check {
|
|
static func main() {
|
|
precondition(MetricFormat.memory(51_539_607_552) == "48.0 GiB")
|
|
precondition(MetricFormat.memory(0) == "0 B")
|
|
precondition(MetricFormat.memory(nil) == "--")
|
|
guard let m = MemoryMonitor.sample() else { fatalError("No sample") }
|
|
precondition(m.app + m.wired + m.compressed + m.available == m.total)
|
|
print("Memory checks passed: total=\(MetricFormat.memory(m.total)), used=\(MetricFormat.memory(m.used)), cached=\(MetricFormat.memory(m.cached)), pressure=\(String(describing: m.pressure))")
|
|
}
|
|
}
|