| OLD | NEW |
| 1 function writeString(s, a, offset) { | 1 function writeString(s, a, offset) { |
| 2 for (var i = 0; i < s.length; ++i) { | 2 for (var i = 0; i < s.length; ++i) { |
| 3 a[offset + i] = s.charCodeAt(i); | 3 a[offset + i] = s.charCodeAt(i); |
| 4 } | 4 } |
| 5 } | 5 } |
| 6 | 6 |
| 7 function writeInt16(n, a, offset) { | 7 function writeInt16(n, a, offset) { |
| 8 n = Math.floor(n); | 8 n = Math.floor(n); |
| 9 | 9 |
| 10 var b1 = n & 255; | 10 var b1 = n & 255; |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // Should('Zero', 0).beEqualTo(0); | 502 // Should('Zero', 0).beEqualTo(0); |
| 503 // Result: | 503 // Result: |
| 504 // "PASS Zero is equal to 0." | 504 // "PASS Zero is equal to 0." |
| 505 ShouldModel.prototype.beEqualTo = function (value) { | 505 ShouldModel.prototype.beEqualTo = function (value) { |
| 506 var type = typeof value; | 506 var type = typeof value; |
| 507 this._assert(type === 'number' || type === 'string', | 507 this._assert(type === 'number' || type === 'string', |
| 508 'value should be number or string for', value); | 508 'value should be number or string for', value); |
| 509 | 509 |
| 510 this._checkNaN(value, 'EXPECTED'); | 510 this._checkNaN(value, 'EXPECTED'); |
| 511 | 511 |
| 512 if (this.target === value) | 512 var outputValue = value; |
| 513 this._testPassed('is equal to ' + value); | 513 if (type === 'string') |
| 514 else | 514 outputValue = '"' + outputValue + '"'; |
| 515 this._testFailed('was ' + this.target + ' instead of ' + value); | 515 if (this.target === value) { |
| 516 var outputValue = (type === 'string') ? '"' + value + '"' : value; |
| 517 this._testPassed('is equal to ' + outputValue); |
| 518 } else { |
| 519 var targetValue = this.target; |
| 520 if (typeof this.target === 'string') |
| 521 targetValue = '"' + targetValue + '"'; |
| 522 this._testFailed('was ' + targetValue + ' instead of ' + outputValue
); |
| 523 } |
| 516 return this._success; | 524 return this._success; |
| 517 }; | 525 }; |
| 518 | 526 |
| 519 // Check if |target| is not equal to |value|. | 527 // Check if |target| is not equal to |value|. |
| 520 // | 528 // |
| 521 // Example: | 529 // Example: |
| 522 // Should('One', one).notBeEqualTo(0); | 530 // Should('One', one).notBeEqualTo(0); |
| 523 // Result: | 531 // Result: |
| 524 // "PASS One is not equal to 0." | 532 // "PASS One is not equal to 0." |
| 525 ShouldModel.prototype.notBeEqualTo = function (value) { | 533 ShouldModel.prototype.notBeEqualTo = function (value) { |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 if (opts.hasOwnProperty('verbose')) | 1057 if (opts.hasOwnProperty('verbose')) |
| 1050 _opts.verbose = opts.verbose; | 1058 _opts.verbose = opts.verbose; |
| 1051 if (opts.hasOwnProperty('precision')) | 1059 if (opts.hasOwnProperty('precision')) |
| 1052 _opts.precision = opts.precision; | 1060 _opts.precision = opts.precision; |
| 1053 } | 1061 } |
| 1054 | 1062 |
| 1055 return new ShouldModel(desc, target, _opts); | 1063 return new ShouldModel(desc, target, _opts); |
| 1056 }; | 1064 }; |
| 1057 | 1065 |
| 1058 })(); | 1066 })(); |
| OLD | NEW |