mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-22 04:40:53 +00:00
dd895daffb
test helper added
107 lines
3.0 KiB
Go
107 lines
3.0 KiB
Go
package voicemeeter
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestGetBasicRemote(t *testing.T) {
|
|
//t.Skip("skipping test")
|
|
__rem := NewRemote("basic")
|
|
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))
|
|
})
|
|
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)
|
|
})
|
|
}
|
|
|
|
func TestGetBananaRemote(t *testing.T) {
|
|
//t.Skip("skipping test")
|
|
__rem := NewRemote("banana")
|
|
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))
|
|
})
|
|
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)
|
|
})
|
|
}
|
|
|
|
func TestGetPotatoRemote(t *testing.T) {
|
|
//t.Skip("skipping test")
|
|
__rem := NewRemote("potato")
|
|
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))
|
|
})
|
|
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)
|
|
})
|
|
}
|
|
|
|
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))
|
|
})
|
|
}
|