Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minorSeventhSharpFive #40

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Tonic/Chord.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ extension Chord {
returnArray.append(contentsOf: Chord.getRankedChords(from: noteArray))
}

// Sorts anti-alphabetical, but the net effect is to pefer flats to sharps
// Sorts anti-alphabetical, but the net effect is to prefer flats to sharps
returnArray.sort { $0.root.letter > $1.root.letter }

// order the array by least number of accidentals
Expand Down
8 changes: 7 additions & 1 deletion Sources/Tonic/ChordType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,15 @@ public enum ChordType: String, CaseIterable, Codable {
/// Half Diminished Ninth: Minor Third, Diminished Fifth, Minor Seventh, Minor Ninth, Perfect Eleventh
case halfDiminishedEleventh

/// Minor Seventh Flat Five: Major Third, Diminished Fifth, Major Seventh
/// Major Seventh Flat Five: Major Third, Diminished Fifth, Major Seventh
case majorSeventhFlatFive

/// Major Seventh Sharp Five: Major Third, Augmented Fifth, Major Seventh
case majorSeventhSharpFive

/// Minor Seventh Flat Five: Minor Third, Diminished Fifth, Major Seventh
case minorSeventhSharpFive

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

/// Minor Ninth Flat Five: Major Third, Diminished Fifth, Major Seventh, Major Nine
case majorNinthFlatFive

Expand Down Expand Up @@ -208,6 +211,7 @@ public enum ChordType: String, CaseIterable, Codable {
case .halfDiminishedEleventh: return [.m3, .d5, .m7, .m9, .P11]
case .majorSeventhFlatFive: return [.M3, .d5, .M7]
case .majorSeventhSharpFive: return [.M3, .A5, .M7]
case .minorSeventhSharpFive: return [.m3, .A5, .m7]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch and Case Statement Alignment Violation: Case statements should vertically align with their enclosing switch statement. (switch_case_alignment)

case .majorNinthSharpEleventh: return [.M3, .P5, .M7, .M9, .A11]
case .dominantFlatNinthSharpEleventh: return [.M3, .P5, .m7, .m9, .A11]
case .dominantFlatFive: return [.M3, .d5, .m7]
Expand Down Expand Up @@ -270,6 +274,7 @@ extension ChordType: CustomStringConvertible {
case .minorEleventh: return "m11"
case .halfDiminishedEleventh: return "ø11"
case .majorSeventhFlatFive: return "maj7♭5"
case .minorSeventhSharpFive: return "m7♯5"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch and Case Statement Alignment Violation: Case statements should vertically align with their enclosing switch statement. (switch_case_alignment)

case .majorSeventhSharpFive: return "maj7♯5"
case .majorNinthSharpEleventh: return "maj9♯11"
case .dominantFlatFive: return "7♭5"
Expand Down Expand Up @@ -333,6 +338,7 @@ extension ChordType: CustomStringConvertible {
case .halfDiminishedEleventh: return "Ø11"
case .majorSeventhFlatFive: return "^7b5"
case .majorSeventhSharpFive: return "^7#5"
case .minorSeventhSharpFive: return "m7#5"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch and Case Statement Alignment Violation: Case statements should vertically align with their enclosing switch statement. (switch_case_alignment)

case .majorNinthSharpEleventh: return "^9#11"
case .dominantFlatFive: return "7b5"
case .dominantSharpFive: return "7#5"
Expand Down
13 changes: 13 additions & 0 deletions Tests/TonicTests/ChordTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ class ChordTests: XCTestCase {
XCTAssertEqual(chord.map { $0.description }, ["Cmaj7♭5"])
}

func testMajorSeventhSharpFive() {
let notes: [Int8] = [60, 64, 68, 71]
let pitchSet = PitchSet(pitches: notes.map { Pitch($0) } )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing Brace Spacing Violation: Closing brace with closing parenthesis should not have any whitespaces in the middle. (closing_brace)

let chord = Chord.getRankedChords(from: pitchSet)
XCTAssertEqual(chord.map { $0.description }, ["Cmaj7♯5"])
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

func testMinorSeventhSharpFive() {
let notes: [Int8] = [60, 63, 68, 71]
let chord = Chord(.C, type: .minorSeventhSharpFive)
XCTAssertEqual(chord.description, "Cm7♯5")
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

func testMajorNinthFlatFive() {
let notes: [Int8] = [60, 64, 66, 71, 74]
let pitchSet = PitchSet(pitches: notes.map { Pitch($0) } )
Expand Down
Loading