mirror of
https://github.com/onyx-and-iris/voicemeeter.git
synced 2024-11-15 17:40:51 +00:00
tests/examples updated with v2 changes
getCmd in vm-cli always prints value.
This commit is contained in:
parent
c4f00a3dbd
commit
7f2646ca6e
@ -6,7 +6,7 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/eiannone/keyboard"
|
"github.com/eiannone/keyboard"
|
||||||
"github.com/onyx-and-iris/voicemeeter"
|
"github.com/onyx-and-iris/voicemeeter/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -39,9 +39,9 @@ Loop:
|
|||||||
case '0':
|
case '0':
|
||||||
fmt.Printf("Logged into Voicemeeter %s, version %s\n", vm.Type(), vm.Version())
|
fmt.Printf("Logged into Voicemeeter %s, version %s\n", vm.Type(), vm.Version())
|
||||||
case '1':
|
case '1':
|
||||||
vm.Strip[0].SetMute(!vm.Strip[0].GetMute())
|
vm.Strip[0].SetMute(!vm.Strip[0].Mute())
|
||||||
case '2':
|
case '2':
|
||||||
if vm.Strip[3].GetGain() == -12.8 {
|
if vm.Strip[3].Gain() == -12.8 {
|
||||||
vm.Strip[3].FadeBy(-8.3, 500)
|
vm.Strip[3].FadeBy(-8.3, 500)
|
||||||
} else {
|
} else {
|
||||||
vm.Strip[3].FadeTo(-12.8, 500)
|
vm.Strip[3].FadeTo(-12.8, 500)
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/onyx-and-iris/voicemeeter"
|
"github.com/onyx-and-iris/voicemeeter/v2"
|
||||||
|
|
||||||
"github.com/andreykaipov/goobs"
|
"github.com/andreykaipov/goobs"
|
||||||
"github.com/andreykaipov/goobs/api/events"
|
"github.com/andreykaipov/goobs/api/events"
|
||||||
|
@ -2,49 +2,42 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/onyx-and-iris/voicemeeter"
|
"github.com/onyx-and-iris/voicemeeter/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// observer represents a single receiver of updates
|
// observer represents a single receiver of updates
|
||||||
type observer struct {
|
type observer struct {
|
||||||
vm *voicemeeter.Remote
|
vm *voicemeeter.Remote
|
||||||
|
events chan string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newObserver add ldirty events to the eventlist and returns an observer type
|
// newObserver add ldirty events to the eventlist and returns an observer type
|
||||||
func newObserver(vm *voicemeeter.Remote) *observer {
|
func newObserver(vm *voicemeeter.Remote) *observer {
|
||||||
vm.EventAdd("ldirty")
|
o := &observer{vm, make(chan string)}
|
||||||
return &observer{vm}
|
return o
|
||||||
}
|
|
||||||
|
|
||||||
// register registers this observer to receive updates
|
|
||||||
func (o observer) register() {
|
|
||||||
o.vm.Register(o)
|
|
||||||
}
|
|
||||||
|
|
||||||
// deregister deregisters this observer to receive updates
|
|
||||||
func (o observer) deregister() {
|
|
||||||
o.vm.Deregister(o)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnUpdate satisfies the observer interface defined in publisher.go
|
// OnUpdate satisfies the observer interface defined in publisher.go
|
||||||
// for each event type an action is triggered when the event occurs.
|
// for each event type an action is triggered when the event occurs.
|
||||||
func (o observer) OnUpdate(subject string) {
|
func (o observer) Listen() {
|
||||||
if subject == "pdirty" {
|
o.vm.Register(o.events)
|
||||||
fmt.Println("pdirty!")
|
|
||||||
} else if subject == "mdirty" {
|
for s := range o.events {
|
||||||
fmt.Println("mdirty!")
|
switch s {
|
||||||
} else if subject == "midi" {
|
case "pdirty", "mdirty":
|
||||||
var current = o.vm.Midi.Current()
|
fmt.Println(s)
|
||||||
var val = o.vm.Midi.Get(current)
|
case "midi":
|
||||||
fmt.Printf("Value of midi button %d: %d\n", current, val)
|
var current = o.vm.Midi.Current()
|
||||||
} else if subject == "ldirty" {
|
var val = o.vm.Midi.Get(current)
|
||||||
for _, bus := range o.vm.Bus {
|
fmt.Printf("Value of midi button %d: %d\n", current, val)
|
||||||
if bus.Levels().IsDirty() {
|
case "ldirty":
|
||||||
fmt.Println(bus, bus.Levels().All())
|
for _, bus := range o.vm.Bus {
|
||||||
|
if bus.Levels().IsDirty() {
|
||||||
|
fmt.Println(bus, bus.Levels().All())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,6 +47,11 @@ func init() {
|
|||||||
log.SetLevel(log.InfoLevel)
|
log.SetLevel(log.InfoLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func runObserver(vm *voicemeeter.Remote) {
|
||||||
|
o := newObserver(vm)
|
||||||
|
o.Listen()
|
||||||
|
}
|
||||||
|
|
||||||
// main connects to Voiceemeter, registers observer for updates
|
// main connects to Voiceemeter, registers observer for updates
|
||||||
// runs updates for 30 seconds and then deregisters observer.
|
// runs updates for 30 seconds and then deregisters observer.
|
||||||
func main() {
|
func main() {
|
||||||
@ -63,15 +61,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
defer vm.Logout()
|
defer vm.Logout()
|
||||||
|
|
||||||
o := newObserver(vm)
|
runObserver(vm)
|
||||||
o.register()
|
|
||||||
time.Sleep(30 * time.Second)
|
|
||||||
o.deregister()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// vmConnect connects to Voicemeeter potato and logs into the API
|
// vmConnect connects to Voicemeeter potato and logs into the API
|
||||||
func vmConnect() (*voicemeeter.Remote, error) {
|
func vmConnect() (*voicemeeter.Remote, error) {
|
||||||
vm, err := voicemeeter.NewRemote("potato", 0)
|
vm, err := voicemeeter.NewRemote("basic", 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -80,6 +75,7 @@ func vmConnect() (*voicemeeter.Remote, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
vm.EventAdd("ldirty")
|
||||||
|
|
||||||
return vm, nil
|
return vm, nil
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/onyx-and-iris/voicemeeter"
|
"github.com/onyx-and-iris/voicemeeter/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -168,9 +168,9 @@ func getCmd(vm *voicemeeter.Remote, cmd string) error {
|
|||||||
err = fmt.Errorf("unable to get %s", cmd)
|
err = fmt.Errorf("unable to get %s", cmd)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
vPrinter.printf("Value of %s is: %s", cmd, valS)
|
fmt.Printf("Value of %s is: %s", cmd, valS)
|
||||||
} else {
|
} else {
|
||||||
vPrinter.printf("Value of %s is: %v", cmd, valF)
|
fmt.Printf("Value of %s is: %v", cmd, valF)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
package voicemeeter_test
|
package voicemeeter_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/onyx-and-iris/voicemeeter"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
"github.com/onyx-and-iris/voicemeeter/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
vm, err = voicemeeter.NewRemote("potato", 30)
|
logstring bytes.Buffer
|
||||||
|
vm, err = voicemeeter.NewRemote("potato", 30)
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
@ -22,5 +25,7 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
defer vm.Logout()
|
defer vm.Logout()
|
||||||
|
|
||||||
|
log.SetOutput(&logstring)
|
||||||
|
|
||||||
m.Run()
|
m.Run()
|
||||||
}
|
}
|
||||||
|
@ -9,39 +9,39 @@ import (
|
|||||||
func TestStrip0Mute(t *testing.T) {
|
func TestStrip0Mute(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[0].SetMute(true)
|
vm.Strip[0].SetMute(true)
|
||||||
t.Run("Should return true when SetMute(true)", func(t *testing.T) {
|
t.Run("Should return true when Strip[0].SetMute(true)", func(t *testing.T) {
|
||||||
assert.True(t, vm.Strip[0].GetMute())
|
assert.True(t, vm.Strip[0].Mute())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[0].SetMute(false)
|
vm.Strip[0].SetMute(false)
|
||||||
t.Run("Should return false when SetMute(false)", func(t *testing.T) {
|
t.Run("Should return false when Strip[0].SetMute(false)", func(t *testing.T) {
|
||||||
assert.False(t, vm.Strip[0].GetMute())
|
assert.False(t, vm.Strip[0].Mute())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStrip3A1(t *testing.T) {
|
func TestStrip3A1(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[3].SetA1(true)
|
vm.Strip[3].SetA1(true)
|
||||||
t.Run("Should return true when SetA1(true)", func(t *testing.T) {
|
t.Run("Should return true when Strip[3].SetA1(true)", func(t *testing.T) {
|
||||||
assert.True(t, vm.Strip[3].GetA1())
|
assert.True(t, vm.Strip[3].A1())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[3].SetA1(false)
|
vm.Strip[3].SetA1(false)
|
||||||
t.Run("Should return false when SetA1(false)", func(t *testing.T) {
|
t.Run("Should return false when Strip[3].SetA1(false)", func(t *testing.T) {
|
||||||
assert.False(t, vm.Strip[3].GetA1())
|
assert.False(t, vm.Strip[3].A1())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStrip2Limit(t *testing.T) {
|
func TestStrip2Limit(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[2].SetLimit(-8)
|
vm.Strip[2].SetLimit(-8)
|
||||||
t.Run("Should return -8 when SetLimit(-8)", func(t *testing.T) {
|
t.Run("Should return -8 when Strip[2].SetLimit(-8)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[2].GetLimit(), -8)
|
assert.Equal(t, vm.Strip[2].Limit(), -8)
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[2].SetLimit(-32)
|
vm.Strip[2].SetLimit(-32)
|
||||||
t.Run("Should return -32 when SetLimit(-8)", func(t *testing.T) {
|
t.Run("Should return -32 when Strip[2].SetLimit(-32)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[2].GetLimit(), -32)
|
assert.Equal(t, vm.Strip[2].Limit(), -32)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -49,162 +49,197 @@ func TestStrip2Limit(t *testing.T) {
|
|||||||
func TestStrip4Label(t *testing.T) {
|
func TestStrip4Label(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[4].SetLabel("test0")
|
vm.Strip[4].SetLabel("test0")
|
||||||
t.Run("Should return test0 when SetLimit('test0')", func(t *testing.T) {
|
t.Run("Should return test0 when Strip[4].SetLabel('test0')", func(t *testing.T) {
|
||||||
assert.Equal(t, "test0", vm.Strip[4].GetLabel())
|
assert.Equal(t, "test0", vm.Strip[4].Label())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[4].SetLabel("test1")
|
vm.Strip[4].SetLabel("test1")
|
||||||
t.Run("Should return test1 when SetLimit('test1')", func(t *testing.T) {
|
t.Run("Should return test1 when Strip[4].SetLabel('test1')", func(t *testing.T) {
|
||||||
assert.Equal(t, "test1", vm.Strip[4].GetLabel())
|
assert.Equal(t, "test1", vm.Strip[4].Label())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStrip5Gain(t *testing.T) {
|
func TestStrip5Gain(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[4].SetGain(-20.8)
|
vm.Strip[4].SetGain(-20.8)
|
||||||
t.Run("Should return -20.8 when SetGain(-20.8)", func(t *testing.T) {
|
t.Run("Should return -20.8 when Strip[4].SetGain(-20.8)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[4].GetGain(), -20.8)
|
assert.Equal(t, vm.Strip[4].Gain(), -20.8)
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[4].SetGain(-3.6)
|
vm.Strip[4].SetGain(-3.6)
|
||||||
t.Run("Should return -3.6 when SetGain(-3.6)", func(t *testing.T) {
|
t.Run("Should return -3.6 when Strip[4].SetGain(-3.6)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[4].GetGain(), -3.6)
|
assert.Equal(t, vm.Strip[4].Gain(), -3.6)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStrip3Comp(t *testing.T) {
|
func TestStrip3CompKnob(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[4].SetComp(8.1)
|
vm.Strip[4].Comp().SetKnob(8.1)
|
||||||
t.Run("Should return 8.1 when SetGain(8.1)", func(t *testing.T) {
|
t.Run("Should return 8.1 when Strip[4].SetComp(8.1)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[4].GetComp(), 8.1)
|
assert.Equal(t, vm.Strip[4].Comp().Knob(), 8.1)
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[4].SetComp(1.6)
|
vm.Strip[4].Comp().SetKnob(1.6)
|
||||||
t.Run("Should return 1.6 when SetGain(1.6)", func(t *testing.T) {
|
t.Run("Should return 1.6 when Strip[4].SetComp(1.6)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[4].GetComp(), 1.6)
|
assert.Equal(t, vm.Strip[4].Comp().Knob(), 1.6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStrip0CompGainIn(t *testing.T) {
|
||||||
|
//t.Skip("skipping test")
|
||||||
|
vm.Strip[0].Comp().SetGainIn(3.4)
|
||||||
|
t.Run("Should return 3.4 when Strip[0].Comp().SetGainIn(3.4)", func(t *testing.T) {
|
||||||
|
assert.Equal(t, vm.Strip[0].Comp().GainIn(), 3.4)
|
||||||
|
})
|
||||||
|
|
||||||
|
vm.Strip[0].Comp().SetGainIn(-19.3)
|
||||||
|
t.Run("Should return -19.3 when Strip[0].Comp().SetGainIn(-19.3)", func(t *testing.T) {
|
||||||
|
assert.Equal(t, vm.Strip[0].Comp().GainIn(), -19.3)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStrip3GateKnob(t *testing.T) {
|
||||||
|
//t.Skip("skipping test")
|
||||||
|
vm.Strip[4].Gate().SetKnob(8.1)
|
||||||
|
t.Run("Should return 8.1 when Strip[4].SetComp(8.1)", func(t *testing.T) {
|
||||||
|
assert.Equal(t, vm.Strip[4].Gate().Knob(), 8.1)
|
||||||
|
})
|
||||||
|
|
||||||
|
vm.Strip[4].Gate().SetKnob(1.6)
|
||||||
|
t.Run("Should return 1.6 when Strip[4].SetComp(1.6)", func(t *testing.T) {
|
||||||
|
assert.Equal(t, vm.Strip[4].Gate().Knob(), 1.6)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestStrip0GateAttack(t *testing.T) {
|
||||||
|
//t.Skip("skipping test")
|
||||||
|
vm.Strip[0].Comp().SetAttack(3.4)
|
||||||
|
t.Run("Should return 3.4 when Strip[0].Comp().SetAttack(3.4)", func(t *testing.T) {
|
||||||
|
assert.Equal(t, vm.Strip[0].Comp().Attack(), 3.4)
|
||||||
|
})
|
||||||
|
|
||||||
|
vm.Strip[0].Comp().SetAttack(190.3)
|
||||||
|
t.Run("Should return -19.3 when Strip[0].Comp().SetAttack(-19.3)", func(t *testing.T) {
|
||||||
|
assert.Equal(t, vm.Strip[0].Comp().Attack(), 190.3)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStrip5Mc(t *testing.T) {
|
func TestStrip5Mc(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[5].SetMc(true)
|
vm.Strip[5].SetMc(true)
|
||||||
t.Run("Should return true when SetMc(true)", func(t *testing.T) {
|
t.Run("Should return true when Strip[5].SetMc(true)", func(t *testing.T) {
|
||||||
assert.True(t, vm.Strip[5].GetMc())
|
assert.True(t, vm.Strip[5].Mc())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[5].SetMc(false)
|
vm.Strip[5].SetMc(false)
|
||||||
t.Run("Should return false when SetMc(false)", func(t *testing.T) {
|
t.Run("Should return false when Strip[5].SetMc(false)", func(t *testing.T) {
|
||||||
assert.False(t, vm.Strip[5].GetMc())
|
assert.False(t, vm.Strip[5].Mc())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestStrip2GainLayer3(t *testing.T) {
|
func TestStrip2GainLayer3(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Strip[2].GainLayer()[3].Set(-18.3)
|
vm.Strip[2].GainLayer()[3].Set(-18.3)
|
||||||
t.Run("Should return -18.3 when SetMc(true)", func(t *testing.T) {
|
t.Run("Should return -18.3 when Strip[2].GainLayer()[3].Set(-18.3)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[2].GainLayer()[3].Get(), -18.3)
|
assert.Equal(t, vm.Strip[2].GainLayer()[3].Get(), -18.3)
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Strip[2].GainLayer()[3].Set(-25.6)
|
vm.Strip[2].GainLayer()[3].Set(-25.6)
|
||||||
t.Run("Should return -25.6 when SetMc(true)", func(t *testing.T) {
|
t.Run("Should return -25.6 when Strip[2].GainLayer()[3].Set(-25.6)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Strip[2].GainLayer()[3].Get(), -25.6)
|
assert.Equal(t, vm.Strip[2].GainLayer()[3].Get(), -25.6)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBus3Eq(t *testing.T) {
|
func TestBus3EqOn(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Bus[3].SetEq(true)
|
vm.Bus[3].Eq().SetOn(true)
|
||||||
t.Run("Should return true when SetEq(true)", func(t *testing.T) {
|
t.Run("Should return true when Bus[3].Eq().SetOn(true)", func(t *testing.T) {
|
||||||
assert.True(t, vm.Bus[3].GetEq())
|
assert.True(t, vm.Bus[3].Eq().On())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Bus[3].SetEq(false)
|
vm.Bus[3].Eq().SetOn(false)
|
||||||
t.Run("Should return false when SetEq(false)", func(t *testing.T) {
|
t.Run("Should return false when Bus[3].SetEq(false)", func(t *testing.T) {
|
||||||
assert.False(t, vm.Bus[3].GetEq())
|
assert.False(t, vm.Bus[3].Eq().On())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBus4Label(t *testing.T) {
|
func TestBus4Label(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Bus[4].SetLabel("test0")
|
vm.Bus[4].SetLabel("test0")
|
||||||
t.Run("Should return test0 when SetEq('test0')", func(t *testing.T) {
|
t.Run("Should return test0 when Bus[4].SetLabel('test0')", func(t *testing.T) {
|
||||||
assert.Equal(t, "test0", vm.Bus[4].GetLabel())
|
assert.Equal(t, "test0", vm.Bus[4].Label())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Bus[4].SetLabel("test1")
|
vm.Bus[4].SetLabel("test1")
|
||||||
t.Run("Should return test1 when SetEq('test1')", func(t *testing.T) {
|
t.Run("Should return test1 when Bus[4].SetLabel('test1')", func(t *testing.T) {
|
||||||
assert.Equal(t, "test1", vm.Bus[4].GetLabel())
|
assert.Equal(t, "test1", vm.Bus[4].Label())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBus3ModeAmix(t *testing.T) {
|
func TestBus3ModeAmix(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Bus[3].Mode().SetAmix(true)
|
vm.Bus[3].Mode().SetAmix(true)
|
||||||
t.Run("Should return true when Mode().SetAmix(true)", func(t *testing.T) {
|
t.Run("Should return true when Bus[3].Mode().SetAmix(true)", func(t *testing.T) {
|
||||||
assert.True(t, vm.Bus[3].Mode().GetAmix())
|
assert.True(t, vm.Bus[3].Mode().Amix())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVbanInStream0On(t *testing.T) {
|
func TestVbanInStream0On(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Vban.InStream[0].SetOn(true)
|
vm.Vban.InStream[0].SetOn(true)
|
||||||
t.Run("Should return true when SetOn(true)", func(t *testing.T) {
|
t.Run("Should return true when Vban.InStream[0].SetOn(true)", func(t *testing.T) {
|
||||||
assert.True(t, vm.Vban.InStream[0].GetOn())
|
assert.True(t, vm.Vban.InStream[0].On())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Vban.InStream[0].SetOn(false)
|
vm.Vban.InStream[0].SetOn(false)
|
||||||
t.Run("Should return false when SetOn(false)", func(t *testing.T) {
|
t.Run("Should return false when Vban.InStream[0].SetOn(false)", func(t *testing.T) {
|
||||||
assert.False(t, vm.Vban.InStream[0].GetOn())
|
assert.False(t, vm.Vban.InStream[0].On())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVbanOutStream6On(t *testing.T) {
|
func TestVbanOutStream6On(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Vban.OutStream[6].SetOn(true)
|
vm.Vban.OutStream[6].SetOn(true)
|
||||||
t.Run("Should return true when SetOn(true)", func(t *testing.T) {
|
t.Run("Should return true when Vban.OutStream[6].SetOn(true)", func(t *testing.T) {
|
||||||
assert.True(t, vm.Vban.OutStream[6].GetOn())
|
assert.True(t, vm.Vban.OutStream[6].On())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Vban.OutStream[6].SetOn(false)
|
vm.Vban.OutStream[6].SetOn(false)
|
||||||
t.Run("Should return false when SetOn(false)", func(t *testing.T) {
|
t.Run("Should return false when Vban.OutStream[6].SetOn(false)", func(t *testing.T) {
|
||||||
assert.False(t, vm.Vban.OutStream[6].GetOn())
|
assert.False(t, vm.Vban.OutStream[6].On())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVbanOutStream3Name(t *testing.T) {
|
func TestVbanOutStream3Name(t *testing.T) {
|
||||||
t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Vban.OutStream[3].SetName("test0")
|
vm.Vban.OutStream[3].SetName("test0")
|
||||||
t.Run("Should return test0 when SetName('test0')", func(t *testing.T) {
|
t.Run("Should return test0 when Vban.OutStream[3].SetName('test0')", func(t *testing.T) {
|
||||||
assert.Equal(t, "test0", vm.Vban.OutStream[3].GetName())
|
assert.Equal(t, "test0", vm.Vban.OutStream[3].Name())
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Vban.OutStream[3].SetName("test1")
|
vm.Vban.OutStream[3].SetName("test1")
|
||||||
t.Run("Should return test1 when SetName('test1')", func(t *testing.T) {
|
t.Run("Should return test1 when Vban.OutStream[3].SetName('test1')", func(t *testing.T) {
|
||||||
assert.Equal(t, "test1", vm.Vban.OutStream[3].GetName())
|
assert.Equal(t, "test1", vm.Vban.OutStream[3].Name())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVbanInStream4Bit(t *testing.T) {
|
func TestVbanInStream4Bit(t *testing.T) {
|
||||||
t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
t.Run("Should panic when instream SetBit(16)", func(t *testing.T) {
|
vm.Vban.InStream[4].SetBit(16)
|
||||||
defer func() {
|
t.Run("Should log 'bit is readonly for vban instreams' when instream Vban.InStream[4].SetBit(16)", func(t *testing.T) {
|
||||||
if r := recover(); r == nil {
|
assert.Contains(t, logstring.String(), "bit is readonly for vban instreams")
|
||||||
t.Error("expected panic")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
vm.Vban.InStream[4].SetBit(16)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVbanOutStream4Bit(t *testing.T) {
|
func TestVbanOutStream4Bit(t *testing.T) {
|
||||||
//t.Skip("skipping test")
|
//t.Skip("skipping test")
|
||||||
vm.Vban.OutStream[4].SetBit(16)
|
vm.Vban.OutStream[4].SetBit(16)
|
||||||
t.Run("Should return 16 when SetBit(16)", func(t *testing.T) {
|
t.Run("Should return 16 when Vban.OutStream[4].SetBit(16)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Vban.OutStream[4].GetBit(), 16)
|
assert.Equal(t, vm.Vban.OutStream[4].Bit(), 16)
|
||||||
})
|
})
|
||||||
|
|
||||||
vm.Vban.OutStream[4].SetBit(24)
|
vm.Vban.OutStream[4].SetBit(24)
|
||||||
t.Run("Should return 24 when SetBit(24)", func(t *testing.T) {
|
t.Run("Should return 24 when Vban.OutStream[4].SetBit(24)", func(t *testing.T) {
|
||||||
assert.Equal(t, vm.Vban.OutStream[4].GetBit(), 24)
|
assert.Equal(t, vm.Vban.OutStream[4].Bit(), 24)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user