Skip to content

Commit

Permalink
Add test files and include pitch.rb in music_theory.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmacphersonmusic committed May 21, 2015
1 parent 51056ae commit 745f8c7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/music_theory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
require "music_theory/harmonize"
require "music_theory/output"
require "music_theory/play"
require "music_theory/pitch"


module MusicTheory
Expand Down
11 changes: 11 additions & 0 deletions test/implement_pitch_test.rb
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
21 changes: 21 additions & 0 deletions test/pitch_test.rb
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

0 comments on commit 745f8c7

Please sign in to comment.