Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: third_party/protobuf/js/binary/decoder_test.js

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 // Encoding values outside the valid range should assert. 142 // Encoding values outside the valid range should assert.
143 assertThrows(function() {writeValue.call(encoder, lowerLimit * 1.1);}); 143 assertThrows(function() {writeValue.call(encoder, lowerLimit * 1.1);});
144 assertThrows(function() {writeValue.call(encoder, upperLimit * 1.1);}); 144 assertThrows(function() {writeValue.call(encoder, upperLimit * 1.1);});
145 } 145 }
146 146
147 describe('binaryDecoderTest', function() { 147 describe('binaryDecoderTest', function() {
148 /** 148 /**
149 * Tests the decoder instance cache. 149 * Tests the decoder instance cache.
150 * @suppress {visibility}
151 */ 150 */
152 it('testInstanceCache', function() { 151 it('testInstanceCache', /** @suppress {visibility} */ function() {
153 // Empty the instance caches. 152 // Empty the instance caches.
154 jspb.BinaryDecoder.instanceCache_ = []; 153 jspb.BinaryDecoder.instanceCache_ = [];
155 154
156 // Allocating and then freeing a decoder should put it in the instance 155 // Allocating and then freeing a decoder should put it in the instance
157 // cache. 156 // cache.
158 jspb.BinaryDecoder.alloc().free(); 157 jspb.BinaryDecoder.alloc().free();
159 158
160 assertEquals(1, jspb.BinaryDecoder.instanceCache_.length); 159 assertEquals(1, jspb.BinaryDecoder.instanceCache_.length);
161 160
162 // Allocating and then freeing three decoders should leave us with three in 161 // Allocating and then freeing three decoders should leave us with three in
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 325
327 doTestSignedValue( 326 doTestSignedValue(
328 jspb.BinaryDecoder.prototype.readDouble, 327 jspb.BinaryDecoder.prototype.readDouble,
329 jspb.BinaryEncoder.prototype.writeDouble, 328 jspb.BinaryEncoder.prototype.writeDouble,
330 jspb.BinaryConstants.FLOAT64_EPS * 10, 329 jspb.BinaryConstants.FLOAT64_EPS * 10,
331 -jspb.BinaryConstants.FLOAT64_MAX, 330 -jspb.BinaryConstants.FLOAT64_MAX,
332 jspb.BinaryConstants.FLOAT64_MAX, 331 jspb.BinaryConstants.FLOAT64_MAX,
333 function(x) { return x; }); 332 function(x) { return x; });
334 }); 333 });
335 }); 334 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698