1goog.module('protobuf.binary.packedBoolTestPairs'); 2 3const BufferDecoder = goog.require('protobuf.binary.BufferDecoder'); 4const {createBufferDecoder} = goog.require('protobuf.binary.bufferDecoderHelper'); 5 6/** 7 * An array of Pairs of packed bool values and their bit representation. 8 * This is used to test encoding and decoding from/to the protobuf wire format. 9 * @return {!Array<{name: string, boolValues: !Array<boolean>, 10 * bufferDecoder: !BufferDecoder, skip_writer: ?boolean}>} 11 */ 12function getPackedBoolPairs() { 13 return [ 14 { 15 name: 'empty value', 16 boolValues: [], 17 bufferDecoder: createBufferDecoder(0x00), 18 skip_writer: true, 19 }, 20 { 21 name: 'single value', 22 boolValues: [true], 23 bufferDecoder: createBufferDecoder(0x01, 0x01), 24 }, 25 { 26 name: 'single multi-bytes value', 27 boolValues: [true], 28 bufferDecoder: createBufferDecoder(0x02, 0x80, 0x01), 29 skip_writer: true, 30 }, 31 { 32 name: 'multiple values', 33 boolValues: [true, false], 34 bufferDecoder: createBufferDecoder(0x02, 0x01, 0x00), 35 }, 36 { 37 name: 'multiple multi-bytes values', 38 boolValues: [true, false], 39 bufferDecoder: createBufferDecoder( 40 0x0C, // length 41 0x80, 42 0x80, 43 0x80, 44 0x80, 45 0x80, 46 0x01, // true 47 0x80, 48 0x80, 49 0x80, 50 0x80, 51 0x80, 52 0x00, // false 53 ), 54 skip_writer: true, 55 }, 56 ]; 57} 58 59exports = {getPackedBoolPairs}; 60