| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 }); |
| OLD | NEW |