packed_sfixed32_test_pairs.js 1.0 KB

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