fix: add VUScale.spokenLevel with proper clamping and non-finite handling
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -106,3 +106,26 @@ struct LEDBarTests {
|
||||
#expect(LEDBar.litCount(forFraction: -1) == 0)
|
||||
}
|
||||
}
|
||||
|
||||
struct SpokenLevelTests {
|
||||
@Test func nonFiniteInputReturnsStil() {
|
||||
#expect(VUScale.spokenLevel(fromDbfs: -.infinity) == "stil")
|
||||
#expect(VUScale.spokenLevel(fromDbfs: .nan) == "stil")
|
||||
}
|
||||
|
||||
@Test func referenceLevel() {
|
||||
#expect(VUScale.spokenLevel(fromDbfs: -20) == "0 VU")
|
||||
}
|
||||
|
||||
@Test func negativeLevel() {
|
||||
#expect(VUScale.spokenLevel(fromDbfs: -30) == "-9 VU")
|
||||
}
|
||||
|
||||
@Test func clampedToMinimum() {
|
||||
#expect(VUScale.spokenLevel(fromDbfs: -120) == "-20 VU")
|
||||
}
|
||||
|
||||
@Test func clampedToMaximum() {
|
||||
#expect(VUScale.spokenLevel(fromDbfs: 10) == "3 VU")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user