From dd895daffb51d93fa8db1a010ee413614d91c978 Mon Sep 17 00:00:00 2001 From: onyx-and-iris <75868496+onyx-and-iris@users.noreply.github.com> Date: Mon, 22 Aug 2022 22:34:03 +0100 Subject: [PATCH] float/string getter/setter tests added test helper added --- helper_test.go | 24 ++++++++++++++++++++++++ remote_test.go | 21 +++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 helper_test.go diff --git a/helper_test.go b/helper_test.go new file mode 100644 index 0000000..cd38c4e --- /dev/null +++ b/helper_test.go @@ -0,0 +1,24 @@ +package voicemeeter + +import ( + "os" + "testing" + "time" +) + +var ( + vm = NewRemote("potato") +) + +func TestMain(m *testing.M) { + vm.Login() + code := m.Run() + vm.Logout() + os.Exit(code) +} + +func sync() { + time.Sleep(30 * time.Millisecond) + for vm.Pdirty() || vm.Mdirty() { + } +} diff --git a/remote_test.go b/remote_test.go index 1097bd4..a9e02e9 100644 --- a/remote_test.go +++ b/remote_test.go @@ -83,3 +83,24 @@ func TestGetPotatoRemote(t *testing.T) { assert.NotNil(t, __rem.Recorder) }) } + +func TestSetAndGetFloatParameter(t *testing.T) { + //t.Skip("skipping test") + var param = "strip[0].mute" + vm.SetFloat(param, 1) + sync() + t.Run("Should get a float parameter", func(t *testing.T) { + assert.Equal(t, float64(1), vm.GetFloat(param)) + }) +} + +func TestSetAndGetStringParameter(t *testing.T) { + //t.Skip("skipping test") + var param = "strip[0].label" + var val = "test0" + vm.SetString(param, val) + sync() + t.Run("Should get a string parameter", func(t *testing.T) { + assert.Equal(t, val, vm.GetString(param)) + }) +}