mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-09-11 07:59:25 +00:00
update osc-go to v0.4.0
This commit is contained in:
@@ -66,7 +66,7 @@ func TestGoodJsonEncode(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "basic struct",
|
||||
payload: osc.OSCMessage{
|
||||
payload: osc.Message{
|
||||
Address: "/hello",
|
||||
},
|
||||
expected: []byte("{\"address\":\"/hello\",\"args\":null}"),
|
||||
|
||||
@@ -49,8 +49,8 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
params: map[string]any{
|
||||
"address": "/test",
|
||||
},
|
||||
payload: osc.OSCMessage{},
|
||||
expected: &osc.OSCMessage{Address: "/test"},
|
||||
payload: osc.Message{},
|
||||
expected: &osc.Message{Address: "/test"},
|
||||
},
|
||||
{
|
||||
name: "address with template and no args",
|
||||
@@ -58,7 +58,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"address": "/test/{{.Payload.Value}}",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{Address: "/test/value"},
|
||||
expected: &osc.Message{Address: "/test/value"},
|
||||
},
|
||||
{
|
||||
name: "address with template and string arg",
|
||||
@@ -68,7 +68,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "s",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{Address: "/test/value", Args: []osc.OSCArg{{Value: "arg1", Type: "s"}}},
|
||||
expected: &osc.Message{Address: "/test/value", Args: []osc.Arg{{Value: "arg1", Type: "s"}}},
|
||||
},
|
||||
{
|
||||
name: "address with template and mixed args",
|
||||
@@ -78,9 +78,9 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "sif",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{
|
||||
expected: &osc.Message{
|
||||
Address: "/test/value",
|
||||
Args: []osc.OSCArg{
|
||||
Args: []osc.Arg{
|
||||
{Value: "arg1", Type: "s"},
|
||||
{Value: int32(42), Type: "i"},
|
||||
{Value: float32(3.14), Type: "f"},
|
||||
@@ -95,7 +95,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "h",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{Address: "/test/value", Args: []osc.OSCArg{{Value: int64(42), Type: "h"}}},
|
||||
expected: &osc.Message{Address: "/test/value", Args: []osc.Arg{{Value: int64(42), Type: "h"}}},
|
||||
},
|
||||
{
|
||||
name: "address with template and double arg",
|
||||
@@ -105,7 +105,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "d",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{Address: "/test/value", Args: []osc.OSCArg{{Value: float64(42), Type: "d"}}},
|
||||
expected: &osc.Message{Address: "/test/value", Args: []osc.Arg{{Value: float64(42), Type: "d"}}},
|
||||
},
|
||||
{
|
||||
name: "address with template and true arg",
|
||||
@@ -115,7 +115,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "T",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{Address: "/test/value", Args: []osc.OSCArg{{Value: true, Type: "T"}}},
|
||||
expected: &osc.Message{Address: "/test/value", Args: []osc.Arg{{Value: true, Type: "T"}}},
|
||||
},
|
||||
{
|
||||
name: "address with template and false arg",
|
||||
@@ -125,7 +125,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "F",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{Address: "/test/value", Args: []osc.OSCArg{{Value: false, Type: "F"}}},
|
||||
expected: &osc.Message{Address: "/test/value", Args: []osc.Arg{{Value: false, Type: "F"}}},
|
||||
},
|
||||
{
|
||||
name: "address with template and nil arg",
|
||||
@@ -135,7 +135,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "N",
|
||||
},
|
||||
payload: map[string]any{"Value": "value"},
|
||||
expected: &osc.OSCMessage{Address: "/test/value", Args: []osc.OSCArg{{Value: nil, Type: "N"}}},
|
||||
expected: &osc.Message{Address: "/test/value", Args: []osc.Arg{{Value: nil, Type: "N"}}},
|
||||
},
|
||||
{
|
||||
name: "blob arg",
|
||||
@@ -145,7 +145,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
"types": "b",
|
||||
},
|
||||
payload: "",
|
||||
expected: &osc.OSCMessage{Address: "/test", Args: []osc.OSCArg{{Value: []byte{0xde, 0xad, 0xbe, 0xef}, Type: "b"}}},
|
||||
expected: &osc.Message{Address: "/test", Args: []osc.Arg{{Value: []byte{0xde, 0xad, 0xbe, 0xef}, Type: "b"}}},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ func TestGoodOSCMessageCreate(t *testing.T) {
|
||||
return
|
||||
}
|
||||
|
||||
gotMessage, ok := got.Payload.(*osc.OSCMessage)
|
||||
gotMessage, ok := got.Payload.(*osc.Message)
|
||||
if !ok {
|
||||
t.Fatalf("osc.message.create returned a %T payload: %+v", got, got)
|
||||
}
|
||||
|
||||
@@ -39,22 +39,22 @@ func TestGoodOSCMessageDecode(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
payload []byte
|
||||
expected *osc.OSCMessage
|
||||
expected *osc.Message
|
||||
}{
|
||||
{
|
||||
name: "basic OSC message",
|
||||
payload: []byte{47, 116, 101, 115, 116, 0, 0, 0, 44, 0, 0, 0},
|
||||
expected: &osc.OSCMessage{
|
||||
expected: &osc.Message{
|
||||
Address: "/test",
|
||||
Args: []osc.OSCArg{},
|
||||
Args: []osc.Arg{},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "basic OSC message with argument",
|
||||
payload: []byte{47, 116, 101, 115, 116, 0, 0, 0, 44, 105, 0, 0, 0, 0, 0, 42},
|
||||
expected: &osc.OSCMessage{
|
||||
expected: &osc.Message{
|
||||
Address: "/test",
|
||||
Args: []osc.OSCArg{
|
||||
Args: []osc.Arg{
|
||||
{
|
||||
Type: "i",
|
||||
Value: int32(42),
|
||||
@@ -72,7 +72,7 @@ func TestGoodOSCMessageDecode(t *testing.T) {
|
||||
t.Fatalf("osc.message.decode processing failed: %s", err)
|
||||
}
|
||||
|
||||
gotMessage, ok := got.Payload.(*osc.OSCMessage)
|
||||
gotMessage, ok := got.Payload.(*osc.Message)
|
||||
if !ok {
|
||||
t.Fatalf("osc.message.decode returned a %T payload: %+v", got, got)
|
||||
}
|
||||
|
||||
@@ -43,16 +43,16 @@ func TestGoodOSCMessageEncode(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "basic OSC message",
|
||||
payload: &osc.OSCMessage{
|
||||
payload: &osc.Message{
|
||||
Address: "/test",
|
||||
},
|
||||
expected: []byte{47, 116, 101, 115, 116, 0, 0, 0, 44, 0, 0, 0},
|
||||
},
|
||||
{
|
||||
name: "basic OSC message with argument",
|
||||
payload: &osc.OSCMessage{
|
||||
payload: &osc.Message{
|
||||
Address: "/test",
|
||||
Args: []osc.OSCArg{
|
||||
Args: []osc.Arg{
|
||||
{
|
||||
Type: "i",
|
||||
Value: int32(42),
|
||||
@@ -96,9 +96,9 @@ func TestBadOSCMessageEncode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "invalid OSC message argument",
|
||||
payload: &osc.OSCMessage{
|
||||
payload: &osc.Message{
|
||||
Address: "test",
|
||||
Args: []osc.OSCArg{},
|
||||
Args: []osc.Arg{},
|
||||
},
|
||||
errorString: "osc.message.encode processor failed to encode OSCMessage: OSC Message address must start with /",
|
||||
},
|
||||
@@ -120,9 +120,9 @@ func TestBadOSCMessageEncode(t *testing.T) {
|
||||
|
||||
func BenchmarkOSCMessageEncode(b *testing.B) {
|
||||
processorInstance := processor.OSCMessageEncode{}
|
||||
payload := &osc.OSCMessage{
|
||||
payload := &osc.Message{
|
||||
Address: "/test",
|
||||
Args: []osc.OSCArg{
|
||||
Args: []osc.Arg{
|
||||
{
|
||||
Type: "i",
|
||||
Value: int32(42),
|
||||
|
||||
Reference in New Issue
Block a user