OLD | NEW |
1 /* global self */ | 1 /* global self */ |
2 | 2 |
3 // testharness.js has the higher priority. | 3 // testharness.js has the higher priority. |
4 var TESTHARNESS = true; | 4 var TESTHARNESS = true; |
5 var JSTEST = false; | 5 var JSTEST = false; |
6 | 6 |
7 (function () { | 7 (function () { |
8 // Selected properies from testharness.js | 8 // Selected properies from testharness.js |
9 var testharnessProperties = [ | 9 var testharnessProperties = [ |
10 'test', 'async_test', 'promise_test', 'promise_rejects', | 10 'test', 'async_test', 'promise_test', 'promise_rejects', |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 return { | 164 return { |
165 createTaskRunner: function () { | 165 createTaskRunner: function () { |
166 return new Tasks(); | 166 return new Tasks(); |
167 } | 167 } |
168 }; | 168 }; |
169 | 169 |
170 })(); | 170 })(); |
171 | 171 |
172 | 172 |
173 // Compute the (linear) signal-to-noise ratio between |actual| and |expected|.
The result is NOT in | |
174 // dB! If the |actual| and |expected| have different lengths, the shorter lengt
h is used. | |
175 function computeSNR(actual, expected) | |
176 { | |
177 var signalPower = 0; | |
178 var noisePower = 0; | |
179 | |
180 var length = Math.min(actual.length, expected.length); | |
181 | |
182 for (var k = 0; k < length; ++k) { | |
183 var diff = actual[k] - expected[k]; | |
184 signalPower += expected[k] * expected[k]; | |
185 noisePower += diff * diff; | |
186 } | |
187 | |
188 return signalPower / noisePower; | |
189 } | |
190 | |
191 // |Should| JS layout test utility. | 173 // |Should| JS layout test utility. |
192 // Dependency: ../resources/js-test.js | 174 // Dependency: ../resources/js-test.js |
193 var Should = (function () { | 175 var Should = (function () { |
194 | 176 |
195 'use strict'; | 177 'use strict'; |
196 | 178 |
197 // ShouldModel internal class. For the exposed (factory) method, it is the | 179 // ShouldModel internal class. For the exposed (factory) method, it is the |
198 // return value of this closure. | 180 // return value of this closure. |
199 function ShouldModel(desc, target, opts) { | 181 function ShouldModel(desc, target, opts) { |
200 this.desc = desc; | 182 this.desc = desc; |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 if (opts.hasOwnProperty('brief')) | 912 if (opts.hasOwnProperty('brief')) |
931 _opts.brief = opts.brief; | 913 _opts.brief = opts.brief; |
932 if (opts.hasOwnProperty('precision')) | 914 if (opts.hasOwnProperty('precision')) |
933 _opts.precision = opts.precision; | 915 _opts.precision = opts.precision; |
934 } | 916 } |
935 | 917 |
936 return new ShouldModel(desc, target, _opts); | 918 return new ShouldModel(desc, target, _opts); |
937 }; | 919 }; |
938 | 920 |
939 })(); | 921 })(); |
OLD | NEW |