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

Add major and minor keys to music #720

Merged
merged 3 commits into from
Dec 19, 2016
Merged
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
4 changes: 4 additions & 0 deletions lib/faker/music.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def key_variants
['b', '#', '']
end

def key_types
['', 'm']
end

def chord_types
['', 'maj', '6', 'maj7', 'm', 'm7', '-7', '7', 'dom7', 'dim', 'dim7', 'm7b5']
end
Expand Down
9 changes: 8 additions & 1 deletion test/test_faker_music.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ def test_key_variants
end
end

def test_key_types
assert @tester.key_types.size == 2
@tester.key_types.each do |key_type|
assert !key_type.nil?
end
end

def test_chord_types
assert @tester.chord_types.size == 12
@tester.chord_types.each do |chord_type|
Expand All @@ -28,7 +35,7 @@ def test_chord_types
end

def test_key
assert @tester.name.match(/([A-Z])+(b|#){0,1}/)
assert @tester.name.match(/([A-Z])+(b|#){0,1}+(m){0,1}/)
end

def test_instrument
Expand Down