From c87c0768b824df685ef3582cf33eb7f52863c7c1 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 17 Jul 2023 20:00:25 +0100 Subject: [PATCH] more higher tests added --- .gitignore | 1 + README.md | 8 ++++---- test/higher/higher_test.rb | 16 ++++++++-------- test/lower/lower_test.rb | 15 +++++++++++++++ test/minitest_helper.rb | 13 +++++++++++-- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index bbc5b29..79dcc09 100644 --- a/.gitignore +++ b/.gitignore @@ -58,5 +58,6 @@ Gemfile.lock # test quick.rb +config.yaml .vscode/ \ No newline at end of file diff --git a/README.md b/README.md index 7ff9edb..47cd519 100644 --- a/README.md +++ b/README.md @@ -387,19 +387,19 @@ get may return nil if no value for requested key in midi cache ```ruby vm.apply( { - strip_0: { + "strip-0" => { mute: true, gain: 3.2, A1: true }, - bus_3: { + "bus-3" => { gain: -3.2, eq: true }, - button_39: { + "button-39" => { stateonly: true }, - vban_outstream_3: { + "vban-outstream-3" => { on: true, bit: 24 } diff --git a/test/higher/higher_test.rb b/test/higher/higher_test.rb index da9e2da..573aa7e 100644 --- a/test/higher/higher_test.rb +++ b/test/higher/higher_test.rb @@ -10,19 +10,19 @@ class StripTest < Minitest::Test 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) + [-8.2, 3.2].each do |val| + define_method("test_it_sets_and_gets_bus_#{Test.data.phys_out}_gain_#{val}") do + Test.vm.bus[Test.data.phys_out].gain = val + assert_equal(val, Test.vm.bus[Test.data.phys_out].gain) 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) + ["test0", "test1"].each do |val| + define_method("test_it_sets_and_gets_vban_#{Test.data.vban_in}_name_#{val}") do + Test.vm.vban.instream[Test.data.vban_in].name = val + assert_equal(val, Test.vm.vban.instream[Test.data.vban_in].name) end end end diff --git a/test/lower/lower_test.rb b/test/lower/lower_test.rb index e69de29..6a8ee29 100644 --- a/test/lower/lower_test.rb +++ b/test/lower/lower_test.rb @@ -0,0 +1,15 @@ +require_relative "../minitest_helper" + +class SetGetParamTest < Minitest::Test + def test_it_sets_and_gets_float_parameter + Test.vm.set("Fx.Reverb.On", 1) + assert_equal(1, Test.vm.get("Fx.Reverb.On")) + end +end + +class SetGetButtonTest < Minitest::Test + def test_it_sets_and_gets_macrobutton_parameter + Test.vm.set_buttonstatus(0, 3, 1) # button0, trigger, true + assert_equal(1, Test.vm.get_buttonstatus(0, 3)) + end +end diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index e0fe448..da08840 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -11,9 +11,18 @@ class Test @vm end - TestMap = Data.define(:name, :phys_in, :virt_in, :phys_out, :virt_out, :button_lower, :button_higher) + TestMap = Data.define(:name, :phys_in, :virt_in, :phys_out, :virt_out, :button_lower, :button_higher, :vban_in, :vban_out) - @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) + @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, + @vm.kind.vban[0] - 1, + @vm.kind.vban[1] - 1 + ) def self.data @data