1/// The colour band a coverage percentage falls in (docs/DESIGN.md, D4).
2public enum CoverageTier: String, Sendable {
3 /// 90% and up.
4 case high
5 /// 75% and up.
6 case medium
7 case low
8
9 /// The tier of `covered` out of `total`; a file with no code counts as high,
10 /// since nothing in it went untested.
11422 public init(covered: Int, total: Int) {
12422 // Whole numbers, so a file exactly on a boundary never lands below it.
13422 if covered * 100 >= total * 90 {
14307 self = .high
15307 } else if covered * 100 >= total * 75 {
1632 self = .medium
1783 } else {
1883 self = .low
1983 }
20422 }
21}