Skip to content

Commit

Permalink
Add test for sine_wave_cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmacphersonmusic committed May 18, 2015
1 parent f3393c9 commit 3e315b4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/note_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def setup
@frequency = 220.to_f
@duration = 2.0
@sample_rate = 22050
@cycles_per_frame = @frequency / @sample_rate
@note = MusicTheory::Note.new(frequency: @frequency, duration: @duration)
end

Expand All @@ -14,7 +15,11 @@ def test_total_frames
end

def test_cycles_per_frame
cycles_per_frame = @frequency / @sample_rate
assert_equal cycles_per_frame, @note.cycles_per_frame
assert_equal @cycles_per_frame, @note.cycles_per_frame
end

def test_sine_wave_cycle
sine_wave_cycle = 2 * Math::PI * @cycles_per_frame
assert_equal sine_wave_cycle, @note.sine_wave_cycle
end
end

0 comments on commit 3e315b4

Please sign in to comment.