65 lines
1.9 KiB
Swift
65 lines
1.9 KiB
Swift
// SequencerStepTests.swift
|
|
// Lyrebird
|
|
//
|
|
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
import Testing
|
|
@testable @_spi(LyrebirdExtensions) import LyrebirdSynth
|
|
|
|
@Suite("SequencerStep")
|
|
struct SequencerStepTests {
|
|
|
|
@Test func defaultValuesAreCorrect() {
|
|
let step: SequencerStep = SequencerStep(pitch: 60)
|
|
#expect(step.pitch == 60)
|
|
#expect(step.velocity == 0.8)
|
|
#expect(step.gate == 0.8)
|
|
#expect(step.probability == 1.0)
|
|
#expect(step.duration == 1.0)
|
|
#expect(step.parameterLocks.isEmpty)
|
|
}
|
|
|
|
@Test func customValuesAreStored() {
|
|
let step: SequencerStep = SequencerStep(
|
|
pitch: 72,
|
|
velocity: 0.5,
|
|
gate: 0.25,
|
|
probability: 0.6,
|
|
duration: 2.0,
|
|
parameterLocks: ["cutoff": 800.0, "res": 0.5]
|
|
)
|
|
#expect(step.pitch == 72)
|
|
#expect(step.velocity == 0.5)
|
|
#expect(step.gate == 0.25)
|
|
#expect(step.probability == 0.6)
|
|
#expect(step.duration == 2.0)
|
|
#expect(step.parameterLocks["cutoff"] == 800.0)
|
|
#expect(step.parameterLocks["res"] == 0.5)
|
|
}
|
|
|
|
@Test func restHasNegativePitch() {
|
|
#expect(SequencerStep.rest.pitch < 0)
|
|
}
|
|
|
|
@Test func restDurationIsOneBeat() {
|
|
#expect(SequencerStep.rest.duration == 1.0)
|
|
}
|
|
|
|
@Test func stepIsMutable() {
|
|
var step: SequencerStep = SequencerStep(pitch: 60)
|
|
step.pitch = 67
|
|
step.velocity = 0.9
|
|
step.gate = 0.5
|
|
step.probability = 0.75
|
|
step.duration = 2.0
|
|
step.parameterLocks = ["cutoff": 1000.0]
|
|
#expect(step.pitch == 67)
|
|
#expect(step.velocity == 0.9)
|
|
#expect(step.gate == 0.5)
|
|
#expect(step.probability == 0.75)
|
|
#expect(step.duration == 2.0)
|
|
#expect(step.parameterLocks["cutoff"] == 1000.0)
|
|
}
|
|
}
|