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