forked from beneggett/music_theory
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test files and include pitch.rb in music_theory.rb
- Loading branch information
1 parent
51056ae
commit 745f8c7
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
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,11 @@ | ||
require 'test_helper' | ||
|
||
class TestNote < MiniTest::Test | ||
def setup | ||
# @pitch_object_note = MusicTheory::Note.new(frequency: (:B, 4), duration: 1.0, distort: false) | ||
@frequency_note = MusicTheory::Note.new(frequency: 493.883, duration: 1.0, distort: false) | ||
end | ||
|
||
def test_note_accepts_pitch_object_input | ||
end | ||
end |
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,21 @@ | ||
require 'test_helper' | ||
|
||
class TestPitch < MiniTest::Test | ||
def setup | ||
@A4 = Pitch.new :a, 4 | ||
@Ds2 = Pitch.new 'dS', 2 | ||
@Gf5 = Pitch.new :Gf, 5 | ||
end | ||
|
||
def test_frequency | ||
assert_equal @A4.frequency, 440.0 | ||
assert_equal @Ds2.frequency, 77.782 | ||
assert_equal @Gf5.frequency, 739.989 | ||
end | ||
|
||
def test_to_s | ||
assert_equal @A4.to_s, "A 4" | ||
assert_equal @Ds2.to_s, "D# 2" | ||
assert_equal @Gf5.to_s, "Gb 5" | ||
end | ||
end |