1/** 2 * @fileoverview Test data for sfixed32 encoding and decoding. 3 */ 4goog.module('protobuf.binary.sfixed64TestPairs'); 5 6const BufferDecoder = goog.require('protobuf.binary.BufferDecoder'); 7const Int64 = goog.require('protobuf.Int64'); 8const {createBufferDecoder} = goog.require('protobuf.binary.bufferDecoderHelper'); 9 10/** 11 * An array of Pairs of int values and their bit representation. 12 * This is used to test encoding and decoding from/to the protobuf wire format. 13 * @return {!Array<{name: string, longValue: !Int64, bufferDecoder: 14 * !BufferDecoder}>} 15 */ 16function getSfixed64Pairs() { 17 const sfixed64Pairs = [ 18 { 19 name: 'zero', 20 longValue: Int64.fromInt(0), 21 bufferDecoder: 22 createBufferDecoder(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00), 23 }, 24 { 25 name: 'one', 26 longValue: Int64.fromInt(1), 27 bufferDecoder: 28 createBufferDecoder(0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) 29 }, 30 { 31 name: 'minus one', 32 longValue: Int64.fromInt(-1), 33 bufferDecoder: 34 createBufferDecoder(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF), 35 }, 36 { 37 name: 'max int 2^63 -1', 38 longValue: Int64.getMaxValue(), 39 bufferDecoder: 40 createBufferDecoder(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F) 41 }, 42 { 43 name: 'min int -2^63', 44 longValue: Int64.getMinValue(), 45 bufferDecoder: 46 createBufferDecoder(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80) 47 }, 48 ]; 49 return [...sfixed64Pairs]; 50} 51 52exports = {getSfixed64Pairs}; 53