1.0.0 release
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
// StepSequencerStructuralTests.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Testing
|
||||
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
||||
|
||||
@Suite("StepSequencer — structural")
|
||||
struct StepSequencerStructuralTests {
|
||||
|
||||
@Test func initialStateIsIdle() throws {
|
||||
let engine: SynthesisEngine = try makeSeqEngine()
|
||||
let clock: LyrebirdClock = LyrebirdClock(engine: engine, bpm: 120.0)
|
||||
let seq: StepSequencer = StepSequencer(steps: [], clock: clock)
|
||||
#expect(seq.state == .idle)
|
||||
}
|
||||
|
||||
@Test func currentStepStartsAtZero() throws {
|
||||
let engine: SynthesisEngine = try makeSeqEngine()
|
||||
let clock: LyrebirdClock = LyrebirdClock(engine: engine, bpm: 120.0)
|
||||
let seq: StepSequencer = StepSequencer(steps: [SequencerStep(pitch: 60)], clock: clock)
|
||||
#expect(seq.currentStep == 0)
|
||||
}
|
||||
|
||||
@Test func stepsPropertyIsReadWrite() throws {
|
||||
let engine: SynthesisEngine = try makeSeqEngine()
|
||||
let clock: LyrebirdClock = LyrebirdClock(engine: engine, bpm: 120.0)
|
||||
let seq: StepSequencer = StepSequencer(steps: [], clock: clock)
|
||||
seq.steps = [SequencerStep(pitch: 60), SequencerStep(pitch: 64)]
|
||||
#expect(seq.steps.count == 2)
|
||||
#expect(seq.steps[0].pitch == 60)
|
||||
#expect(seq.steps[1].pitch == 64)
|
||||
}
|
||||
|
||||
@Test func clockIsRetained() throws {
|
||||
let engine: SynthesisEngine = try makeSeqEngine()
|
||||
let clock: LyrebirdClock = LyrebirdClock(engine: engine, bpm: 120.0)
|
||||
let seq: StepSequencer = StepSequencer(steps: [], clock: clock)
|
||||
#expect(seq.clock === clock)
|
||||
}
|
||||
|
||||
@Test func stopOnIdleSequencerIsNoop() throws {
|
||||
let engine: SynthesisEngine = try makeSeqEngine()
|
||||
let clock: LyrebirdClock = LyrebirdClock(engine: engine, bpm: 120.0)
|
||||
let seq: StepSequencer = StepSequencer(steps: [], clock: clock)
|
||||
seq.stop()
|
||||
#expect(seq.state == .idle)
|
||||
}
|
||||
|
||||
@Test func resetOnIdleSequencerIsNoop() throws {
|
||||
let engine: SynthesisEngine = try makeSeqEngine()
|
||||
let clock: LyrebirdClock = LyrebirdClock(engine: engine, bpm: 120.0)
|
||||
let seq: StepSequencer = StepSequencer(steps: [], clock: clock)
|
||||
seq.reset()
|
||||
#expect(seq.state == .idle)
|
||||
#expect(seq.currentStep == 0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user