prep for 1.2.0 release updates
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// DemandGeometricTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
@MainActor
|
||||
@Suite("DemandGeometric")
|
||||
struct DemandGeometricTests {
|
||||
|
||||
@Test func emitsGeometricSequence() {
|
||||
let d: DemandGeometric = DemandGeometric(start: 1.0, ratio: 2.0, length: 4)
|
||||
#expect(d.nextValue() == 1.0)
|
||||
#expect(d.nextValue() == 2.0)
|
||||
#expect(d.nextValue() == 4.0)
|
||||
#expect(d.nextValue() == 8.0)
|
||||
#expect(d.nextValue() == nil)
|
||||
#expect(d.isExhausted)
|
||||
}
|
||||
|
||||
@Test func fractionalRatioDecays() {
|
||||
let d: DemandGeometric = DemandGeometric(start: 100.0, ratio: 0.5, length: 3)
|
||||
#expect(d.nextValue() == 100.0)
|
||||
#expect(d.nextValue() == 50.0)
|
||||
#expect(d.nextValue() == 25.0)
|
||||
}
|
||||
|
||||
@Test func resetRestoresInitialValue() {
|
||||
let d: DemandGeometric = DemandGeometric(start: 3.0, ratio: 2.0, length: -1)
|
||||
for _ in 0..<5 { _ = d.nextValue() }
|
||||
d.reset()
|
||||
#expect(d.nextValue() == 3.0)
|
||||
#expect(d.nextValue() == 6.0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user