1/** 2 * @fileoverview Test data for sint64 encoding and decoding. 3 */ 4goog.module('protobuf.binary.sint64TestPairs'); 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 float 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, error: ?boolean, skip_writer: ?boolean}>} 15 */ 16function getSint64Pairs() { 17 const sint64Pairs = [ 18 { 19 name: 'zero', 20 longValue: Int64.fromInt(0), 21 bufferDecoder: createBufferDecoder(0x00), 22 }, 23 { 24 name: 'one ', 25 longValue: Int64.fromInt(1), 26 bufferDecoder: createBufferDecoder(0x02), 27 }, 28 { 29 name: 'minus one', 30 longValue: Int64.fromInt(-1), 31 bufferDecoder: createBufferDecoder(0x01), 32 }, 33 { 34 name: 'two', 35 longValue: Int64.fromInt(2), 36 bufferDecoder: createBufferDecoder(0x04), 37 }, 38 { 39 name: 'minus two', 40 longValue: Int64.fromInt(-2), 41 bufferDecoder: createBufferDecoder(0x03), 42 }, 43 { 44 name: 'min value', 45 longValue: Int64.getMinValue(), 46 bufferDecoder: createBufferDecoder( 47 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01), 48 }, 49 50 { 51 name: 'max value', 52 longValue: Int64.getMaxValue(), 53 bufferDecoder: createBufferDecoder( 54 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01), 55 }, 56 ]; 57 return [...sint64Pairs]; 58} 59 60exports = {getSint64Pairs}; 61