1.0.0 release
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// PatternAccumulateTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
@Suite("Pattern.accumulate")
|
||||
struct PatternAccumulateTests {
|
||||
|
||||
@Test func runningSumStartingFromZero() {
|
||||
let pat: Pattern<Double> = Pattern.accumulate(
|
||||
Pattern.sequence([1.0, 2.0, 3.0, 4.0], repeats: 1)
|
||||
)
|
||||
#expect(pat.next() == 1.0)
|
||||
#expect(pat.next() == 3.0)
|
||||
#expect(pat.next() == 6.0)
|
||||
#expect(pat.next() == 10.0)
|
||||
#expect(pat.next() == nil)
|
||||
}
|
||||
|
||||
@Test func customInitial() {
|
||||
let pat: Pattern<Double> = Pattern.accumulate(
|
||||
Pattern.sequence([10.0, 20.0], repeats: 1),
|
||||
initial: 100.0
|
||||
)
|
||||
#expect(pat.next() == 110.0)
|
||||
#expect(pat.next() == 130.0)
|
||||
#expect(pat.next() == nil)
|
||||
}
|
||||
|
||||
@Test func resetRewindsTotal() {
|
||||
let pat: Pattern<Double> = Pattern.accumulate(
|
||||
Pattern.sequence([5.0, 5.0], repeats: -1),
|
||||
initial: 0.0
|
||||
)
|
||||
#expect(pat.next() == 5.0)
|
||||
#expect(pat.next() == 10.0)
|
||||
pat.reset()
|
||||
#expect(pat.next() == 5.0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user