mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-08-11 02:03:42 +00:00
add examples from OSC 1.0 spec to decode test
This commit is contained in:
@@ -38,6 +38,26 @@ const tests = [
|
||||
bytes: Buffer.from('2f68656c6c6f00002c460000', 'hex'),
|
||||
expected: { address: '/hello', args: [{ type: 'F', value: false }] },
|
||||
},
|
||||
{
|
||||
description: 'osc 1.0 spec example 1',
|
||||
bytes: Buffer.from('2f6f7363696c6c61746f722f342f6672657175656e6379002c66000043dc0000', 'hex'),
|
||||
expected: { address: '/oscillator/4/frequency', args: [{ type: 'f', value: 440 }] },
|
||||
},
|
||||
{
|
||||
description: 'osc 1.0 spec example 2',
|
||||
bytes: Buffer.from('2f666f6f000000002c69697366660000000003e8ffffffff68656c6c6f0000003f9df3b640b5b22d', 'hex'),
|
||||
expected: {
|
||||
address: '/foo',
|
||||
args: [
|
||||
{ type: 'i', value: 1000 },
|
||||
{ type: 'i', value: -1 },
|
||||
{ type: 's', value: 'hello' },
|
||||
// thanks IEEE 754
|
||||
{ type: 'f', value: 1.2339999675750732421875 },
|
||||
{ type: 'f', value: 5.677999973297119140625 },
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
describe('OSC Message Decoding', () => {
|
||||
|
||||
Reference in New Issue
Block a user