• Home
  • Raw
  • Download

Lines Matching full:decoder

32  * @fileoverview Test cases for jspb's binary protocol buffer decoder.
74 var decoder = jspb.BinaryDecoder.alloc(encoder.end());
77 assertEquals(filter(0), readValue.call(decoder));
78 assertEquals(filter(epsilon), readValue.call(decoder));
79 assertEquals(filter(upperLimit), readValue.call(decoder));
83 if (filter(cursor) != readValue.call(decoder)) throw 'fail!';
129 var decoder = jspb.BinaryDecoder.alloc(encoder.end());
132 assertEquals(filter(lowerLimit), readValue.call(decoder));
133 assertEquals(filter(-epsilon), readValue.call(decoder));
134 assertEquals(filter(0), readValue.call(decoder));
135 assertEquals(filter(epsilon), readValue.call(decoder));
136 assertEquals(filter(upperLimit), readValue.call(decoder));
140 assertEquals(inputValues[i], readValue.call(decoder));
156 * Tests the decoder instance cache.
162 // Allocating and then freeing a decoder should put it in the instance
184 var /** !jspb.BinaryDecoder */ decoder;
207 decoder = jspb.BinaryDecoder.alloc(encoder.end());
211 assertEquals(hashA, decoder.readVarintHash64());
212 assertEquals(hashB, decoder.readVarintHash64());
213 assertEquals(hashC, decoder.readVarintHash64());
214 assertEquals(hashD, decoder.readVarintHash64());
216 assertEquals(hashA, decoder.readFixedHash64());
217 assertEquals(hashB, decoder.readFixedHash64());
218 assertEquals(hashC, decoder.readFixedHash64());
219 assertEquals(hashD, decoder.readFixedHash64());
232 expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashA));
233 expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashB));
234 expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashC));
235 expect(decoder.readSplitVarint64(hexJoin)).toEqual(hexJoinHash(hashD));
237 expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashA));
238 expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashB));
239 expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashC));
240 expect(decoder.readSplitFixed64(hexJoin)).toEqual(hexJoinHash(hashD));
245 var /** !jspb.BinaryDecoder */ decoder;
263 decoder = jspb.BinaryDecoder.alloc(encoder.end());
268 expect(decoder.readZigzagVarint64String())
270 expect(decoder.readZigzagVarint64String())
272 expect(decoder.readZigzagVarint64String())
274 expect(decoder.readZigzagVarint64String())
279 expect(decoder.readZigzagVarintHash64()).toEqual(hashA);
280 expect(decoder.readZigzagVarintHash64()).toEqual(hashB);
281 expect(decoder.readZigzagVarintHash64()).toEqual(hashC);
282 expect(decoder.readZigzagVarintHash64()).toEqual(hashD);
295 expect(decoder.readSplitZigzagVarint64(hexJoin))
297 expect(decoder.readSplitZigzagVarint64(hexJoin))
299 expect(decoder.readSplitZigzagVarint64(hexJoin))
301 expect(decoder.readSplitZigzagVarint64(hexJoin))
347 var decoder = jspb.BinaryDecoder.alloc(encoder.end());
349 assertEquals(long_string, decoder.readString(len));
368 var decoder = jspb.BinaryDecoder.alloc(encoder.end());
370 assertEquals(ascii, decoder.readString(ascii.length));
371 assertEquals(utf8_two_bytes, decoder.readString(utf8_two_bytes.length));
372 assertEquals(utf8_three_bytes, decoder.readString(utf8_three_bytes.length));
373 assertEquals(utf8_four_bytes, decoder.readString(utf8_four_bytes.length));
377 * Verifies that misuse of the decoder class triggers assertions.
381 var decoder = jspb.BinaryDecoder.alloc([0, 1, 2]);
382 assertThrows(function() {decoder.readUint64()});
385 decoder.setBlock([255, 255, 255, 255, 255, 255,
387 assertThrows(function() {decoder.readUnsignedVarint64()});
388 decoder.reset();
389 assertThrows(function() {decoder.readSignedVarint64()});
390 decoder.reset();
391 assertThrows(function() {decoder.readZigzagVarint64()});
392 decoder.reset();
393 assertThrows(function() {decoder.readUnsignedVarint32()});