packed_int64_test_pairs.js 1.0 KB

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