OLD | NEW |
1 if (window.testRunner) | 1 if (window.testRunner) |
2 testRunner.overridePreference("WebKitWebAudioEnabled", "1"); | 2 testRunner.overridePreference("WebKitWebAudioEnabled", "1"); |
3 | 3 |
4 function writeString(s, a, offset) { | 4 function writeString(s, a, offset) { |
5 for (var i = 0; i < s.length; ++i) { | 5 for (var i = 0; i < s.length; ++i) { |
6 a[offset + i] = s.charCodeAt(i); | 6 a[offset + i] = s.charCodeAt(i); |
7 } | 7 } |
8 } | 8 } |
9 | 9 |
10 function writeInt16(n, a, offset) { | 10 function writeInt16(n, a, offset) { |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 var type = typeof value; | 433 var type = typeof value; |
434 this._assert(type === 'number' || type === 'string', | 434 this._assert(type === 'number' || type === 'string', |
435 'value should be number or string for'); | 435 'value should be number or string for'); |
436 | 436 |
437 if (this.target === value) | 437 if (this.target === value) |
438 this._testFailed('should not be equal to ' + value); | 438 this._testFailed('should not be equal to ' + value); |
439 else | 439 else |
440 this._testPassed('is not equal to ' + value); | 440 this._testPassed('is not equal to ' + value); |
441 }; | 441 }; |
442 | 442 |
| 443 // Check if |target| is greater than or equal to |value|. |
| 444 // |
| 445 // Example: |
| 446 // Should("SNR", snr).greaterThanOrEqualTo(100); |
| 447 // Result: |
| 448 // "PASS SNR exceeds 100" |
| 449 // "FAIL SNR (n) is not greater than or equal to 100" |
| 450 ShouldModel.prototype.beGreaterThanOrEqualTo = function (value) { |
| 451 var type = typeof value; |
| 452 this._assert(type === 'number' || type === 'string', |
| 453 'value should be number or string for'); |
| 454 |
| 455 if (this.target >= value) |
| 456 this._testPassed("is greater than or equal to " + value); |
| 457 else |
| 458 this._testFailed("(" + this.target + ") is not greater than or equal
to " + value); |
| 459 } |
| 460 |
443 // Check if |func| throws an exception with a certain |errorType| correctly. | 461 // Check if |func| throws an exception with a certain |errorType| correctly. |
444 // |errorType| is optional. | 462 // |errorType| is optional. |
445 // | 463 // |
446 // Example: | 464 // Example: |
447 // Should('A bad code', function () { var a = b; }).throw(); | 465 // Should('A bad code', function () { var a = b; }).throw(); |
448 // Result: | 466 // Result: |
449 // "PASS A bad code threw an exception." | 467 // "PASS A bad code threw an exception." |
450 // Example: | 468 // Example: |
451 // Should('var c = d', function () { var c = d; }).throw('ReferenceError'); | 469 // Should('var c = d', function () { var c = d; }).throw('ReferenceError'); |
452 // "PASS var c = d threw ReferenceError." | 470 // "PASS var c = d threw ReferenceError." |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 if (opts.hasOwnProperty('numberOfErrorLog')) | 676 if (opts.hasOwnProperty('numberOfErrorLog')) |
659 _opts.numberOfErrorLog = opts.numberOfErrorLog; | 677 _opts.numberOfErrorLog = opts.numberOfErrorLog; |
660 if (opts.hasOwnProperty('numberOfArrayLog')) | 678 if (opts.hasOwnProperty('numberOfArrayLog')) |
661 _opts.numberOfArrayLog = opts.numberOfArrayLog; | 679 _opts.numberOfArrayLog = opts.numberOfArrayLog; |
662 } | 680 } |
663 | 681 |
664 return new ShouldModel(desc, target, _opts); | 682 return new ShouldModel(desc, target, _opts); |
665 }; | 683 }; |
666 | 684 |
667 })(); | 685 })(); |
OLD | NEW |