Skip to content

Commit

Permalink
Merge pull request #59 from orchetect/dev
Browse files Browse the repository at this point in the history
Dev merge
  • Loading branch information
orchetect authored Dec 6, 2021
2 parents 4faa715 + 55e87b1 commit 0b42c79
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 19 deletions.
11 changes: 11 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/MIDIKit-CI.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@
BlueprintName = "MIDIKitTests"
ReferencedContainer = "container:">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "RoundTrip_NewCoreMIDIAPI_1_0_Protocol_Tests">
</Test>
<Test
Identifier = "RoundTrip_NewCoreMIDIAPI_2_0_Protocol_Tests">
</Test>
<Test
Identifier = "RoundTrip_OldCoreMIDIAPI_Tests">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
</TestAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extension UnsafeMutablePointer where Pointee == MIDIPacketList {
// return nil
// }

let timeTag = mach_absolute_time()
let timeTag: UInt64 = 0 // 0 means "now"

let packetListPointer: UnsafeMutablePointer<MIDIPacketList> = .allocate(capacity: 1)

Expand Down Expand Up @@ -90,7 +90,7 @@ extension UnsafeMutablePointer where Pointee == MIDIPacketList {
)
}

let timeTag = mach_absolute_time()
let timeTag: UInt64 = 0 // 0 means "now"

let packetListPointer: UnsafeMutablePointer<MIDIPacketList> = .allocate(capacity: 1)

Expand Down
2 changes: 1 addition & 1 deletion Tests/MIDIKitTests/IO/Inputs and Outputs/Input Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CoreMIDI

final class InputsAndOutputs_Input_Tests: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

override func setUp() {
manager = .init(clientName: "MIDIKit_IO_InputsAndOutputs_Input_Tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CoreMIDI

final class InputsAndOutputs_InputConnection_Tests: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

override func setUp() {
manager = .init(clientName: "MIDIKit_IO_InputsAndOutputs_InputConnection_Tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CoreMIDI

final class InputsAndOutputs_Output_Tests: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

override func setUp() {
manager = .init(clientName: "MIDIKit_IO_InputsAndOutputs_Output_Tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CoreMIDI

final class InputsAndOutputs_OutputConnection_Tests: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

override func setUp() {
manager = .init(clientName: "MIDIKit_IO_InputsAndOutputs_OutputConnection_Tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import CoreMIDI

final class InputsAndOutputs_ThruConnection_Tests: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

override func setUp() {
manager = .init(clientName: "MIDIKit_IO_InputsAndOutputs_ThruConnection_Tests",
Expand Down
2 changes: 1 addition & 1 deletion Tests/MIDIKitTests/IO/Manager/Manager Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CoreMIDI

final class Manager_Tests: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

override func setUp() {
manager = .init(clientName: "MIDIKit_IO_Manager_Tests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import XCTest

class AnyEndpoint_Tests: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

override func setUp() {
manager = .init(clientName: "MIDIKit_IO_AnyEndpoint_Tests",
model: "MIDIKit123",
manufacturer: "MIDIKit")

guard let _ = try? manager.start() else {
XCTFail("Couldn't start MIDI.IO.Manager.")
do {
try manager.start()
} catch {
XCTFail("Could not start MIDI Manager. \(error.localizedDescription)")
return
}
}
Expand Down
30 changes: 22 additions & 8 deletions Tests/MIDIKitTests/Integration Tests/Round Trip Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import XCTest
import MIDIKit
import CoreMIDI

final class RoundTrip_Tests: XCTestCase {
class RoundTrip_Tests_Base: XCTestCase {

var manager: MIDI.IO.Manager! = nil
fileprivate var manager: MIDI.IO.Manager! = nil

let outputTag = "1"
let inputConnectionTag = "2"
fileprivate let outputTag = "1"
fileprivate let inputConnectionTag = "2"

var receivedEvents: [MIDI.Event] = []
fileprivate var receivedEvents: [MIDI.Event] = []

override func setUp() {

Expand All @@ -31,8 +31,10 @@ final class RoundTrip_Tests: XCTestCase {

// start midi client

guard (try? manager.start()) != nil else {
XCTFail("Could not start MIDI Manager.")
do {
try manager.start()
} catch {
XCTFail("Could not start MIDI Manager. \(error.localizedDescription)")
return
}

Expand Down Expand Up @@ -199,6 +201,10 @@ final class RoundTrip_Tests: XCTestCase {

}

}

final class RoundTrip_OldCoreMIDIAPI_Tests: RoundTrip_Tests_Base {

func testRapidMIDIEvents_OldCoreMIDIAPI() throws {

manager.preferredAPI = .legacyCoreMIDI
Expand All @@ -209,6 +215,10 @@ final class RoundTrip_Tests: XCTestCase {

}

}

final class RoundTrip_NewCoreMIDIAPI_1_0_Protocol_Tests: RoundTrip_Tests_Base {

func testRapidMIDIEvents_NewCoreMIDIAPI_1_0_Protocol() throws {

manager.preferredAPI = .newCoreMIDI(._1_0)
Expand All @@ -219,7 +229,11 @@ final class RoundTrip_Tests: XCTestCase {

}

#warning("> TODO: enable this test once MIDI 2.0 is fully implemented")
}

final class RoundTrip_NewCoreMIDIAPI_2_0_Protocol_Tests: RoundTrip_Tests_Base {

#warning("> TODO: enable this test once MIDI 2.0 is fully implemented")
// func testRapidMIDIEvents_NewCoreMIDIAPI_2_0_Protocol() throws {
//
// manager.preferredAPI = .newCoreMIDI(._2_0)
Expand Down

0 comments on commit 0b42c79

Please sign in to comment.