mirror of
https://github.com/jwetzell/osc-go.git
synced 2026-08-20 05:48:59 +00:00
add layout for testing bundle error cases
This commit is contained in:
+22
-4
@@ -134,10 +134,28 @@ func TestBadOSCBundleDecoding(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "bundle header not properly null terminated",
|
name: "bundle header not properly null terminated",
|
||||||
bytes: []byte{35, 98, 117, 110, 100, 108, 101, 35, 0, 0, 0,
|
bytes: []byte{
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
35, 98, 117, 110, 100, 108, 101,
|
||||||
0, 0, 0, 0},
|
35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35},
|
||||||
errorString: "OSC Bundle must start with #bundle string",
|
errorString: "OSC string must be null-terminated",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bundle contains incorrect size",
|
||||||
|
bytes: []byte{
|
||||||
|
35, 98, 117, 110, 100, 108, 101, 0, // #bundle
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, // time tag
|
||||||
|
0, 0, 0, 100, // content size of 100 but only 10 bytes of content
|
||||||
|
35, 35, 35, 35, 35, 35, 35, 35, 35, 35},
|
||||||
|
errorString: "bundle doesn't have enough bytes for the content size it specifies",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "bundle doesn't contain message or bundle",
|
||||||
|
bytes: []byte{
|
||||||
|
35, 98, 117, 110, 100, 108, 101, 0, // #bundle
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, // time tag
|
||||||
|
0, 0, 0, 10,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
|
errorString: "bundle contents does not look a bundle or message",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user