Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

test cleanup, input buffer test

  • Loading branch information...
commit c68a7cccf51014c11771a54f6d84489750cfc14c 1 parent 938868a
@arirusso authored
View
12 Rakefile
@@ -0,0 +1,12 @@
+
+require 'rake'
+require 'rake/testtask'
+
+Rake::TestTask.new(:test) do |t|
+
+ t.libs << "test"
+ t.test_files = FileList["test/**/test_*.rb"]
+ t.verbose = true
+end
+
+task :default => [:test]
View
0  test/test_helper.rb → test/helper.rb
File renamed without changes
View
45 test/test_input_buffer.rb
@@ -0,0 +1,45 @@
+#!/usr/bin/env ruby
+
+require 'helper'
+
+class InputBufferTest < Test::Unit::TestCase
+
+ include MIDIWinMM
+ include TestHelper
+ include TestHelper::Config # before running these tests, adjust the constants in config.rb to suit your hardware setup
+ # ** this test assumes that TestOutput is connected to TestInput
+
+ def test_input_buffer
+ sleep(1)
+
+ messages = VariousMIDIMessages
+ bytes = []
+
+ TestOutput.open do |output|
+ TestInput.open do |input|
+
+ messages.each do |msg|
+
+ $>.puts "sending: " + msg.inspect
+
+ output.puts(msg)
+
+ bytes += msg
+
+ sleep(0.5)
+
+ buffer = input.buffer.map { |m| m[:data] }.flatten
+
+ $>.puts "received: " + buffer.to_s
+
+ assert_equal(bytes, buffer)
+
+ end
+
+ assert_equal(input.buffer.length, messages.length)
+
+ end
+ end
+ end
+
+end
View
2  test/io_test.rb → test/test_io.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/test_helper'
+require "helper"
class IoTest < Test::Unit::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.