Skip to content

Commit 39cc670

Browse files
committed
write failing test
1 parent 9ac80b2 commit 39cc670

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Tests/AudioKitEXTests/CallbackInstrumentTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,20 @@ class CallbackInstrumentTests: XCTestCase {
6666
/// If the callback does get called, this will fail our test, adding insult to injury
6767
XCTAssertEqual(data, expectedData)
6868
}
69+
70+
func testClearsBuffer() {
71+
let input = PlaygroundOscillator(waveform: Table([1, 1]))
72+
let callback = CallbackInstrument()
73+
74+
let engine = AudioEngine()
75+
let mixer = Mixer(input, callback)
76+
engine.output = mixer
77+
78+
input.start()
79+
let audio = engine.startTest(totalDuration: 1.0)
80+
audio.append(engine.render(duration: 1.0))
81+
82+
XCTAssertTrue(audio.toFloatChannelData()!.flatMap { $0 }.allSatisfy { $0 == 1 })
83+
}
6984
}
7085
#endif

0 commit comments

Comments
 (0)