| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // messages are suppressed. the value is fairly arbitrary, but shouldn't | 413 // messages are suppressed. the value is fairly arbitrary, but shouldn't |
| 414 // be too small or too large. | 414 // be too small or too large. |
| 415 this.NUM_ERRORS_LOG = opts.numberOfErrorLog; | 415 this.NUM_ERRORS_LOG = opts.numberOfErrorLog; |
| 416 | 416 |
| 417 // If the number of array elements is greater than this, the rest of | 417 // If the number of array elements is greater than this, the rest of |
| 418 // elements will be omitted. | 418 // elements will be omitted. |
| 419 this.NUM_ARRAY_LOG = opts.numberOfArrayLog; | 419 this.NUM_ARRAY_LOG = opts.numberOfArrayLog; |
| 420 | 420 |
| 421 // If true, verbose output for the failure case is printed, for methods
where this makes | 421 // If true, verbose output for the failure case is printed, for methods
where this makes |
| 422 // sense. | 422 // sense. |
| 423 this.verbose = opts.verbose; | 423 this.verbose = !opts.brief; |
| 424 | 424 |
| 425 // If set, this is the precision with which numbers will be printed. | 425 // If set, this is the precision with which numbers will be printed. |
| 426 this.PRINT_PRECISION = opts.precision; | 426 this.PRINT_PRECISION = opts.precision; |
| 427 } | 427 } |
| 428 | 428 |
| 429 // Internal methods starting with a underscore. | 429 // Internal methods starting with a underscore. |
| 430 ShouldModel.prototype._testPassed = function (msg) { | 430 ShouldModel.prototype._testPassed = function (msg) { |
| 431 testPassed(this.desc + ' ' + msg + '.'); | 431 testPassed(this.desc + ' ' + msg + '.'); |
| 432 this._success = true; | 432 this._success = true; |
| 433 }; | 433 }; |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 | 1039 |
| 1040 // Should() method. | 1040 // Should() method. |
| 1041 // | 1041 // |
| 1042 // |desc| is the description of the task or check and |target| is a value | 1042 // |desc| is the description of the task or check and |target| is a value |
| 1043 // needs to be checked or a task to be performed. |opt| contains options for | 1043 // needs to be checked or a task to be performed. |opt| contains options for |
| 1044 // printing out log messages: options are |opt.numberOfErrorLog| and | 1044 // printing out log messages: options are |opt.numberOfErrorLog| and |
| 1045 // |opts.numberOfArrayLog|. | 1045 // |opts.numberOfArrayLog|. |
| 1046 return function (desc, target, opts) { | 1046 return function (desc, target, opts) { |
| 1047 var _opts = { | 1047 var _opts = { |
| 1048 numberOfErrorLog: 8, | 1048 numberOfErrorLog: 8, |
| 1049 numberOfArrayLog: 16 | 1049 numberOfArrayLog: 16, |
| 1050 verbose: true |
| 1050 }; | 1051 }; |
| 1051 | 1052 |
| 1052 if (opts instanceof Object) { | 1053 if (opts instanceof Object) { |
| 1053 if (opts.hasOwnProperty('numberOfErrorLog')) | 1054 if (opts.hasOwnProperty('numberOfErrorLog')) |
| 1054 _opts.numberOfErrorLog = opts.numberOfErrorLog; | 1055 _opts.numberOfErrorLog = opts.numberOfErrorLog; |
| 1055 if (opts.hasOwnProperty('numberOfArrayLog')) | 1056 if (opts.hasOwnProperty('numberOfArrayLog')) |
| 1056 _opts.numberOfArrayLog = opts.numberOfArrayLog; | 1057 _opts.numberOfArrayLog = opts.numberOfArrayLog; |
| 1057 if (opts.hasOwnProperty('verbose')) | 1058 if (opts.hasOwnProperty('brief')) |
| 1058 _opts.verbose = opts.verbose; | 1059 _opts.brief = opts.brief; |
| 1059 if (opts.hasOwnProperty('precision')) | 1060 if (opts.hasOwnProperty('precision')) |
| 1060 _opts.precision = opts.precision; | 1061 _opts.precision = opts.precision; |
| 1061 } | 1062 } |
| 1062 | 1063 |
| 1063 return new ShouldModel(desc, target, _opts); | 1064 return new ShouldModel(desc, target, _opts); |
| 1064 }; | 1065 }; |
| 1065 | 1066 |
| 1066 })(); | 1067 })(); |
| OLD | NEW |