prep for 1.2.0 release updates
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// DemandSeriesTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
@MainActor
|
||||
@Suite("DemandSeries")
|
||||
struct DemandSeriesTests {
|
||||
|
||||
@Test func emitsArithmeticSequence() {
|
||||
let d: DemandSeries = DemandSeries(start: 0.0, step: 2.0, length: 4)
|
||||
#expect(d.nextValue() == 0.0)
|
||||
#expect(d.nextValue() == 2.0)
|
||||
#expect(d.nextValue() == 4.0)
|
||||
#expect(d.nextValue() == 6.0)
|
||||
#expect(d.nextValue() == nil)
|
||||
#expect(d.isExhausted)
|
||||
}
|
||||
|
||||
@Test func infiniteLengthNeverExhausts() {
|
||||
let d: DemandSeries = DemandSeries(start: 1.0, step: 1.0, length: -1)
|
||||
for _ in 0..<1_000 { _ = d.nextValue() }
|
||||
#expect(!d.isExhausted)
|
||||
}
|
||||
|
||||
@Test func resetRestartsFromStart() {
|
||||
let d: DemandSeries = DemandSeries(start: 5.0, step: 1.0, length: 2)
|
||||
_ = d.nextValue(); _ = d.nextValue()
|
||||
#expect(d.isExhausted)
|
||||
d.reset()
|
||||
#expect(!d.isExhausted)
|
||||
#expect(d.nextValue() == 5.0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user