• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1goog.module('protobuf.binary.packedInt64TestPairs');
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 int64 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, int64Values: !Array<!Int64>,
11 *                  bufferDecoder: !BufferDecoder, skip_writer: ?boolean}>}
12 */
13function getPackedInt64Pairs() {
14  return [
15    {
16      name: 'empty value',
17      int64Values: [],
18      bufferDecoder: createBufferDecoder(0x00),
19      skip_writer: true,
20    },
21    {
22      name: 'single value',
23      int64Values: [Int64.fromInt(1)],
24      bufferDecoder: createBufferDecoder(0x01, 0x01),
25    },
26    {
27      name: 'multiple values',
28      int64Values: [Int64.fromInt(1), Int64.fromInt(0)],
29      bufferDecoder: createBufferDecoder(0x02, 0x01, 0x00),
30    },
31  ];
32}
33
34exports = {getPackedInt64Pairs};
35