Files
Lyrebird/LiveCompile/Tests/LyrebirdLiveCompileTests/MessageLogTests.swift
T
josh b6fdee8bfc Lyrebird 2.0.0 — Linux support
Consolidated release: the cross-platform Linux port (engine, generators, CLI,
REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable
WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux
live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive.
See RELEASES.md and LINUX_README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-10 21:09:11 -07:00

44 lines
1.2 KiB
Swift

// MessageLogTests.swift
// Lyrebird
//
// Copyright (c) 2026 Joshua Parmenter / realizedsound
// SPDX-License-Identifier: MIT
#if os(macOS) || os(Linux)
import Testing
import LyrebirdSynth
@testable import LyrebirdLiveCompile
@MainActor
@Suite("LiveSession message log")
struct MessageLogTests {
private func makeSession() -> LiveSession {
let engine: SynthesisEngine = SynthesisEngine(
blockSize: 64,
controlBlockSize: 16,
sampleRate: 48_000,
numOutputChannels: 2,
numInputChannels: 0,
numAudioBuses: 16,
numControlBuses: 16,
eventQueueCapacity: lyrebirdDefaultEventQueueCapacity,
driver: OfflineDriver()
)
return LiveSession(engine: engine)
}
@Test func accumulatesAndDrains() {
let session: LiveSession = makeSession()
session.appendMessage("a")
session.appendMessage("b")
#expect(session.lastSnippetMessage == "b") // last value, for tests
#expect(session.drainMessages() == ["a", "b"])
// Drained → empty.
#expect(session.lastSnippetMessage == nil)
#expect(session.drainMessages().isEmpty)
}
}
#endif