From 0852b61eea0444c0087a65b3b51ac426a761027f Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 3 Nov 2024 15:47:03 +0000 Subject: [PATCH] add external vm/matrix tests --- testdata/matrix.txt | 4 ++++ testdata/vm.txt | 3 +++ vbantxt_test.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 testdata/matrix.txt create mode 100644 testdata/vm.txt create mode 100644 vbantxt_test.go diff --git a/testdata/matrix.txt b/testdata/matrix.txt new file mode 100644 index 0000000..cbcf907 --- /dev/null +++ b/testdata/matrix.txt @@ -0,0 +1,4 @@ +Point(ASIO128.IN[1..4],ASIO128.OUT[1]).dBGain = -3 +Point(ASIO128.IN[1..4],ASIO128.OUT[2]).dBGain = -3 +Point(ASIO128.IN[1..4],ASIO128.OUT[1]).Mute = 1 +Point(ASIO128.IN[1..4],ASIO128.OUT[2]).Mute = 1 \ No newline at end of file diff --git a/testdata/vm.txt b/testdata/vm.txt new file mode 100644 index 0000000..0ff788d --- /dev/null +++ b/testdata/vm.txt @@ -0,0 +1,3 @@ +strip[0].mute=1;strip[0].mono=0 +strip[1].mute=0;strip[1].mono=1 +bus[3].eq.On=0 \ No newline at end of file diff --git a/vbantxt_test.go b/vbantxt_test.go new file mode 100644 index 0000000..8a21265 --- /dev/null +++ b/vbantxt_test.go @@ -0,0 +1,42 @@ +package vbantxt_test + +import ( + "bufio" + "bytes" + _ "embed" + "testing" + + "github.com/onyx-and-iris/vbantxt" + "github.com/stretchr/testify/require" +) + +//go:embed testdata/vm.txt +var vm []byte + +//go:embed testdata/matrix.txt +var matrix []byte + +func run(t *testing.T, client *vbantxt.VbanTxt, script []byte) { + t.Helper() + + r := bytes.NewReader(script) + scanner := bufio.NewScanner(r) + for scanner.Scan() { + err := client.Send(scanner.Text()) + require.NoError(t, err) + } +} + +func TestSendVm(t *testing.T) { + client, err := vbantxt.New("vm.local", 6980, "onyx") + require.NoError(t, err) + + run(t, client, vm) +} + +func TestSendMatrix(t *testing.T) { + client, err := vbantxt.New("vm.local", 6990, "onyx") + require.NoError(t, err) + + run(t, client, matrix) +}