Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
979 B
33 lines
979 B
goog.module('protobuf.binary.packedInt32TestPairs'); |
|
|
|
const BufferDecoder = goog.require('protobuf.binary.BufferDecoder'); |
|
const {createBufferDecoder} = goog.require('protobuf.binary.bufferDecoderHelper'); |
|
|
|
/** |
|
* An array of Pairs of packed int32 values and their bit representation. |
|
* This is used to test encoding and decoding from/to the protobuf wire format. |
|
* @return {!Array<{name: string, int32Values: !Array<number>, |
|
* bufferDecoder: !BufferDecoder, skip_writer: ?boolean}>} |
|
*/ |
|
function getPackedInt32Pairs() { |
|
return [ |
|
{ |
|
name: 'empty value', |
|
int32Values: [], |
|
bufferDecoder: createBufferDecoder(0x00), |
|
skip_writer: true, |
|
}, |
|
{ |
|
name: 'single value', |
|
int32Values: [1], |
|
bufferDecoder: createBufferDecoder(0x01, 0x01), |
|
}, |
|
{ |
|
name: 'multiple values', |
|
int32Values: [1, 0], |
|
bufferDecoder: createBufferDecoder(0x02, 0x01, 0x00), |
|
}, |
|
]; |
|
} |
|
|
|
exports = {getPackedInt32Pairs};
|
|
|