packed_sfixed64_test_pairs.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. goog.module('protobuf.binary.packedSfixed64TestPairs');
  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 sfixed64 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, sfixed64Values: !Array<!Int64>,
  9. * bufferDecoder: !BufferDecoder, skip_writer: ?boolean}>}
  10. */
  11. function getPackedSfixed64Pairs() {
  12. return [
  13. {
  14. name: 'empty value',
  15. sfixed64Values: [],
  16. bufferDecoder: createBufferDecoder(0x00),
  17. skip_writer: true,
  18. },
  19. {
  20. name: 'single value',
  21. sfixed64Values: [Int64.fromInt(1)],
  22. bufferDecoder: createBufferDecoder(
  23. 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00),
  24. },
  25. {
  26. name: 'multiple values',
  27. sfixed64Values: [Int64.fromInt(1), Int64.fromInt(0)],
  28. bufferDecoder: createBufferDecoder(
  29. 0x10, // length
  30. 0x01,
  31. 0x00,
  32. 0x00,
  33. 0x00,
  34. 0x00,
  35. 0x00,
  36. 0x00,
  37. 0x00, // 1
  38. 0x00,
  39. 0x00,
  40. 0x00,
  41. 0x00,
  42. 0x00,
  43. 0x00,
  44. 0x00,
  45. 0x00, // 2
  46. ),
  47. },
  48. ];
  49. }
  50. exports = {getPackedSfixed64Pairs};