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