mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-21 17:30:49 +00:00
started implemented tests
rakefile added
This commit is contained in:
parent
4e419fa74f
commit
1dd3ff17cf
6
rakefile
Normal file
6
rakefile
Normal file
@ -0,0 +1,6 @@
|
||||
require "rake/testtask"
|
||||
|
||||
Rake::TestTask.new do |t|
|
||||
t.pattern = "test/**/*_test.rb"
|
||||
end
|
||||
task default: :test
|
48
test/higher/higher_test.rb
Normal file
48
test/higher/higher_test.rb
Normal file
@ -0,0 +1,48 @@
|
||||
require_relative "../minitest_helper"
|
||||
|
||||
class StripTest < Minitest::Test
|
||||
[false, true].each do |val|
|
||||
define_method("test_it_sets_and_gets_strip_#{Test.data.phys_in}_mute_#{val}") do
|
||||
Test.vm.strip[Test.data.phys_in].mute = val
|
||||
assert_equal(val, Test.vm.strip[Test.data.phys_in].mute)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class BusTest < Minitest::Test
|
||||
[false, true].each do |val|
|
||||
define_method("test_it_sets_and_gets_bus_#{Test.data.phys_out}_mute_#{val}") do
|
||||
Test.vm.bus[Test.data.phys_out].mute = val
|
||||
assert_equal(val, Test.vm.bus[Test.data.phys_out].mute)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class VbanTest < Minitest::Test
|
||||
[false, true].each do |val|
|
||||
define_method("test_it_sets_and_gets_vban_#{Test.data.phys_in}_on_#{val}") do
|
||||
Test.vm.vban.instream[0].on = val
|
||||
assert_equal(val, Test.vm.vban.instream[0].on)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class ButtonTest < Minitest::Test
|
||||
[false, true].each do |val|
|
||||
define_method("test_it_sets_and_gets_button_#{Test.data.button_lower}_stateonly_#{val}") do
|
||||
Test.vm.button[Test.data.button_lower].stateonly = val
|
||||
assert_equal(val, Test.vm.button[Test.data.button_lower].stateonly)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class RecorderTest < Minitest::Test
|
||||
if Test.data.name != :basic
|
||||
[false, true].each do |val|
|
||||
define_method("test_it_sets_and_gets_recorder_mode_loop_#{val}") do
|
||||
Test.vm.recorder.mode.loop = val
|
||||
assert_equal(val, Test.vm.recorder.mode.loop)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
0
test/lower/lower_test.rb
Normal file
0
test/lower/lower_test.rb
Normal file
23
test/minitest_helper.rb
Normal file
23
test/minitest_helper.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require "minitest/autorun"
|
||||
|
||||
require_relative "../lib/voicemeeter"
|
||||
|
||||
class Test
|
||||
@vm = Voicemeeter::Remote.new([:basic, :banana, :potato].sample)
|
||||
@vm.login
|
||||
puts "Running #{@vm.kind.name} tests"
|
||||
|
||||
def self.vm
|
||||
@vm
|
||||
end
|
||||
|
||||
TestMap = Data.define(:name, :phys_in, :virt_in, :phys_out, :virt_out, :button_lower, :button_higher)
|
||||
|
||||
@data = TestMap.new(@vm.kind.name, @vm.kind.phys_in - 1, @vm.kind.virt_in - 1, @vm.kind.phys_out - 1, @vm.kind.virt_out - 1, 0, 79)
|
||||
|
||||
def self.data
|
||||
@data
|
||||
end
|
||||
|
||||
Minitest.after_run { @vm.logout }
|
||||
end
|
Loading…
Reference in New Issue
Block a user