2022-06-25 01:18:20 +01:00
|
|
|
package voicemeeter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetBasicRemote(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
2022-09-14 16:05:15 +01:00
|
|
|
__rem, _ := NewRemote("basic", 0)
|
2022-06-25 01:18:20 +01:00
|
|
|
t.Run("Should return a remote basic type", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem)
|
|
|
|
})
|
|
|
|
t.Run("Should equal 'Voicemeeter Basic'", func(t *testing.T) {
|
|
|
|
assert.Equal(t, "Voicemeeter Basic", __rem.String())
|
|
|
|
})
|
|
|
|
t.Run("Should strip length equal 3", func(t *testing.T) {
|
|
|
|
assert.Equal(t, 3, len(__rem.Strip))
|
|
|
|
})
|
|
|
|
t.Run("Should bus length equal 2", func(t *testing.T) {
|
|
|
|
assert.Equal(t, 2, len(__rem.Bus))
|
|
|
|
})
|
2022-06-28 14:34:03 +01:00
|
|
|
t.Run("Should return a valid command pointer", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Command)
|
|
|
|
})
|
|
|
|
t.Run("Should return a valid vban pointer", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Vban)
|
|
|
|
})
|
|
|
|
t.Run("Should return nil recorder pointer", func(t *testing.T) {
|
|
|
|
assert.Nil(t, __rem.Recorder)
|
|
|
|
})
|
2022-06-25 01:18:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestGetBananaRemote(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
2022-09-14 16:05:15 +01:00
|
|
|
__rem, _ := NewRemote("banana", 0)
|
2022-06-25 01:18:20 +01:00
|
|
|
t.Run("Should return a remote banana type", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem)
|
|
|
|
})
|
|
|
|
t.Run("Should equal 'Voicemeeter Banana'", func(t *testing.T) {
|
|
|
|
assert.Equal(t, "Voicemeeter Banana", __rem.String())
|
|
|
|
})
|
|
|
|
t.Run("Should strip length equal 5", func(t *testing.T) {
|
|
|
|
assert.Equal(t, 5, len(__rem.Strip))
|
|
|
|
})
|
|
|
|
t.Run("Should bus length equal 5", func(t *testing.T) {
|
|
|
|
assert.Equal(t, 5, len(__rem.Bus))
|
|
|
|
})
|
2022-06-28 14:34:03 +01:00
|
|
|
t.Run("Should return a valid command pointer", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Command)
|
|
|
|
})
|
|
|
|
t.Run("Should return a valid vban pointer", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Vban)
|
|
|
|
})
|
|
|
|
t.Run("Should return a valid recorder", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Recorder)
|
|
|
|
})
|
2022-06-25 01:18:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestGetPotatoRemote(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
2022-09-14 16:05:15 +01:00
|
|
|
__rem, _ := NewRemote("potato", 0)
|
2022-06-25 01:18:20 +01:00
|
|
|
t.Run("Should return a remote basic type", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem)
|
|
|
|
})
|
|
|
|
t.Run("Should equal 'Voicemeeter Potato'", func(t *testing.T) {
|
|
|
|
assert.Equal(t, "Voicemeeter Potato", __rem.String())
|
|
|
|
})
|
|
|
|
t.Run("Should strip length equal 8", func(t *testing.T) {
|
|
|
|
assert.Equal(t, 8, len(__rem.Strip))
|
|
|
|
})
|
|
|
|
t.Run("Should bus length equal 8", func(t *testing.T) {
|
|
|
|
assert.Equal(t, 8, len(__rem.Bus))
|
|
|
|
})
|
2022-06-28 14:34:03 +01:00
|
|
|
t.Run("Should return a valid command pointer", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Command)
|
|
|
|
})
|
|
|
|
t.Run("Should return a valid vban pointer", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Vban)
|
|
|
|
})
|
|
|
|
t.Run("Should return a valid recorder", func(t *testing.T) {
|
|
|
|
assert.NotNil(t, __rem.Recorder)
|
|
|
|
})
|
2022-06-25 01:18:20 +01:00
|
|
|
}
|
2022-08-22 22:34:03 +01:00
|
|
|
|
|
|
|
func TestSetAndGetFloatParameter(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
|
|
|
var param = "strip[0].mute"
|
2022-09-18 05:35:04 +01:00
|
|
|
var exp = float64(1)
|
2022-08-22 22:34:03 +01:00
|
|
|
vm.SetFloat(param, 1)
|
|
|
|
t.Run("Should get a float parameter", func(t *testing.T) {
|
2022-09-18 05:35:04 +01:00
|
|
|
val, _ := vm.GetFloat(param)
|
|
|
|
assert.Equal(t, exp, val)
|
2022-08-22 22:34:03 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestSetAndGetStringParameter(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
|
|
|
var param = "strip[0].label"
|
2022-09-18 05:35:04 +01:00
|
|
|
var exp = "test0"
|
|
|
|
vm.SetString(param, exp)
|
2022-08-22 22:34:03 +01:00
|
|
|
t.Run("Should get a string parameter", func(t *testing.T) {
|
2022-09-18 05:35:04 +01:00
|
|
|
val, _ := vm.GetString(param)
|
|
|
|
assert.Equal(t, exp, val)
|
2022-08-22 22:34:03 +01:00
|
|
|
})
|
|
|
|
}
|