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