Skip to content

Commit c8df960

Browse files
authored
[Proof of Concept] Pull in LilyPondTestSuite XML file from disk (#83)
1 parent 52ac53c commit c8df960

File tree

263 files changed

+41
-2491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+41
-2491
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ osx_image: xcode11
88
install:
99
- eval "$(curl -sL https://swiftenv.fuller.li/install.sh)"
1010
env:
11-
- SWIFT_VERSION=DEVELOPMENT-SNAPSHOT-2019-08-01-a CODECOV_TOKEN=52103015-769c-4c59-b537-4fa9fe91c41c
11+
- SWIFT_VERSION=5.1
1212
script:
1313
- swift package update
1414
- if [ $TRAVIS_OS_NAME = 'osx' ]; then
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// LilyPondTestSuite.swift
3+
// MusicXMLTests
4+
//
5+
// Created by James Bean on 9/28/19.
6+
//
7+
8+
import Foundation
9+
import MusicXML
10+
11+
enum LilyPondTestSuite {
12+
enum Traversal: String, CaseIterable {
13+
case partwise = "Partwise"
14+
case timewise = "Timewise"
15+
}
16+
static func url(testName: String, traversal: Traversal) -> URL {
17+
return URL(fileURLWithPath: "\(#file)")
18+
.deletingLastPathComponent()
19+
.deletingLastPathComponent()
20+
.deletingLastPathComponent()
21+
.appendingPathComponent("LilyPondTestSuite", isDirectory: true)
22+
.appendingPathComponent(traversal.rawValue, isDirectory: true)
23+
.appendingPathComponent("\(testName).xml")
24+
}
25+
static func string(testName: String, traversal: Traversal) throws -> String {
26+
return try String(contentsOf: url(testName: testName, traversal: traversal))
27+
}
28+
}
29+
30+
extension MusicXML {
31+
32+
/// Create a `MusicXML` structure with the given `testFileName` and the given `traversal`.
33+
///
34+
/// This grabs the `.xml` file from the `Tests/LilyPondTestSuite` directory.
35+
init(testFileName: Swift.String, traversal: LilyPondTestSuite.Traversal) throws {
36+
try self.init(string: LilyPondTestSuite.string(testName: testFileName, traversal: traversal))
37+
}
38+
}

Tests/MusicXMLTests/LilyPondTests/Partwise/01_Pitch/Partwise_01_Pitches.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import MusicXML
1111
class Partwise_01_Pitches: XCTestCase {
1212

1313
func test_01_Pitches() throws {
14-
let _ = try MusicXML(string: A_Pitches)
14+
let _ = try MusicXML(testFileName: "01a-Pitches-Pitches", traversal: .partwise)
1515
let _ = try MusicXML(string: B_Intervals)
1616
let _ = try MusicXML(string: C_NoVoiceElement)
1717
let _ = try MusicXML(string: D_Microtones)

0 commit comments

Comments
 (0)