Sha256: b2bc4d2e7ae4c1f16b2b202044bf3b0898c3024fd6b6e7578e1aae8f2fcecdcc

Contents?: true

Size: 808 Bytes

Versions: 4

Compression:

Stored size: 808 Bytes

Contents

require 'test_helper'

class ChannelTest < Test::Unit::TestCase
  def subject
    @subject ||= Banjo::Channel.new(0)
  end

  def test_channel
    assert_equal 0, subject.channel
  end

  def test_tick_note_plays
    mock(subject).play_note(15, 50, 0.5)
    subject.tick_note(0, 15)
  end

  def test_tick_note_does_not_play
    mock(subject).play_note(15, 50, 0.5).never
    subject.tick_note(3, 15)
  end

  def test_mod_note_when_note_plays
    [0, 4, 8, 12].each do |tick|
      subject.tick = tick
      mock(subject).play_note(15, 50, 0.5)
      subject.mod_note(4, 15)
    end
  end

  def test_mod_note_when_note_does_not_play
    ((0..15).to_a - [0, 4, 8, 12]).each do |tick|
      subject.tick = tick
      mock(subject).play_note(15, 50, 0.5).never
      subject.mod_note(4, 15)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
banjo-0.0.4 test/cases/banjo/channel_test.rb
banjo-0.0.3 test/cases/banjo/channel_test.rb
banjo-0.0.2 test/cases/banjo/channel_test.rb
banjo-0.0.1 test/cases/banjo/channel_test.rb