started implemented tests

rakefile added
This commit is contained in:
onyx-and-iris 2023-07-17 14:14:16 +01:00
parent 4e419fa74f
commit 1dd3ff17cf
4 changed files with 77 additions and 0 deletions

6
rakefile Normal file
View File

@ -0,0 +1,6 @@
require "rake/testtask"
Rake::TestTask.new do |t|
t.pattern = "test/**/*_test.rb"
end
task default: :test

View 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
View File

23
test/minitest_helper.rb Normal file
View 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