-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
Tests/MIDIKitCoreTests/Events/MIDIEvent/Channel Voice/Channel Voice Tests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// Channel Voice Tests.swift | ||
// MIDIKit • https://github.com/orchetect/MIDIKit | ||
// © 2021-2023 Steffan Andrews • Licensed under MIT License | ||
// | ||
|
||
#if shouldTestCurrentPlatform | ||
|
||
@testable import MIDIKitCore | ||
import XCTest | ||
|
||
final class MIDIEvent_ChannelVoiceTests_Tests: XCTestCase { | ||
// MARK: - Channel Voice Event encoding | ||
|
||
func testProgramChange_RawBytes_MIDI1_0() { | ||
XCTAssertEqual( | ||
MIDIEvent.programChange(program: 0x64, bank: .noBankSelect, channel: 10, group: 0).midi1RawBytes(), | ||
[0xCA, 0x64] | ||
) | ||
|
||
XCTAssertEqual( | ||
MIDIEvent.programChange(program: 0x64, bank: .bankSelect(msb: 0x10, lsb: 0x00), channel: 10, group: 0).midi1RawBytes(), | ||
[ | ||
0xBA, 0x00, 0x10, // Bank Select MSB | ||
0xBA, 0x20, 0x00, // Bank Select LSB | ||
0xCA, 0x64 // Program Change | ||
] | ||
) | ||
|
||
XCTAssertEqual( | ||
MIDIEvent.programChange(program: 0x64, bank: .bankSelect(msb: 0x10, lsb: 0x01), channel: 10, group: 0).midi1RawBytes(), | ||
[ | ||
0xBA, 0x00, 0x10, // Bank Select MSB | ||
0xBA, 0x20, 0x01, // Bank Select LSB | ||
0xCA, 0x64 // Program Change | ||
] | ||
) | ||
} | ||
|
||
// TODO: Add unit tests for other Channel Voice events | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters