-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathpacked_double_test_pairs.js
52 lines (49 loc) · 1.3 KB
/
packed_double_test_pairs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
goog.module('protobuf.binary.packedDoubleTestPairs');
const BufferDecoder = goog.require('protobuf.binary.BufferDecoder');
const {createBufferDecoder} = goog.require('protobuf.binary.bufferDecoderHelper');
/**
* An array of Pairs of packed double values and their bit representation.
* This is used to test encoding and decoding from/to the protobuf wire format.
* @return {!Array<{name: string, doubleValues: !Array<number>,
* bufferDecoder: !BufferDecoder, skip_writer: ?boolean}>}
*/
function getPackedDoublePairs() {
return [
{
name: 'empty value',
doubleValues: [],
bufferDecoder: createBufferDecoder(0x00),
skip_writer: true,
},
{
name: 'single value',
doubleValues: [1],
bufferDecoder: createBufferDecoder(
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F),
},
{
name: 'multiple values',
doubleValues: [1, 0],
bufferDecoder: createBufferDecoder(
0x10, // length
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0xF0,
0x3F, // 1
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00, // 0
),
},
];
}
exports = {getPackedDoublePairs};