packed_sint64_test_pairs.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. goog.module('protobuf.binary.packedSint64TestPairs');
  2. const BufferDecoder = goog.require('protobuf.binary.BufferDecoder');
  3. const Int64 = goog.require('protobuf.Int64');
  4. const {createBufferDecoder} = goog.require('protobuf.binary.bufferDecoderHelper');
  5. /**
  6. * An array of Pairs of packed sint64 values and their bit representation.
  7. * This is used to test encoding and decoding from/to the protobuf wire format.
  8. * @return {!Array<{name: string, sint64Values: !Array<number>,
  9. * bufferDecoder: !BufferDecoder, skip_writer: ?boolean}>}
  10. */
  11. function getPackedSint64Pairs() {
  12. return [
  13. {
  14. name: 'empty value',
  15. sint64Values: [],
  16. bufferDecoder: createBufferDecoder(0x00),
  17. skip_writer: true,
  18. },
  19. {
  20. name: 'single value',
  21. sint64Values: [Int64.fromInt(-1)],
  22. bufferDecoder: createBufferDecoder(0x01, 0x01),
  23. },
  24. {
  25. name: 'multiple values',
  26. sint64Values: [Int64.fromInt(-1), Int64.fromInt(0)],
  27. bufferDecoder: createBufferDecoder(0x02, 0x01, 0x00),
  28. },
  29. ];
  30. }
  31. exports = {getPackedSint64Pairs};