Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>A simple unit testing for audio-testing.js and testharness.js</title> | |
| 5 | |
| 6 <!-- This is the required dependency for testharness + audio-testing. Note | |
| 7 that the including order matters because audio-testing.js depends on | |
| 8 testharness.js --> | |
|
Raymond Toy
2016/08/04 18:07:08
Is this because audio-testing.js checks for testha
hongchan
2016/08/04 18:31:37
Should and Audit both rely on testharness. I think
| |
| 9 <script src="../resources/testharness.js"></script> | |
| 10 <script src="../resources/testharnessreport.js"></script> | |
| 11 <script src="resources/audio-testing.js"></script> | |
| 12 | |
| 13 </head> | |
| 14 <body> | |
| 15 <script> | |
| 16 var audit = Audit.createTaskRunner(); | |
| 17 | |
| 18 audit.defineTask('foo', function (taskDone) { | |
| 19 Should('Zero', 0).beEqualTo(0); | |
| 20 Should('One', 1).notBeEqualTo(0); | |
| 21 Should('Expected SNR', 110).beGreaterThanOrEqualTo(100); | |
| 22 taskDone(); | |
| 23 }); | |
| 24 | |
| 25 audit.defineTask('bar', function (taskDone) { | |
| 26 var maxError = 1e-6; | |
| 27 Should("Maximum error value", maxError).beLessThanOrEqualTo(1e-5); | |
| 28 // Should("max error", maxError).beLessThanOrEqualTo(-1); | |
| 29 Should('One point double zero one', 1.001).beCloseTo(1, .1); | |
| 30 // Should('Two', 2).beCloseTo(1, .1); | |
| 31 taskDone(); | |
| 32 }); | |
| 33 | |
| 34 audit.defineTask('boo', function (taskDone) { | |
| 35 Should('[2, 2, 2]', [2, 2, 2]).beConstantValueOf(2); | |
| 36 Should('[1, 2, 3]', [1, 2, 3]).beEqualToArray([1, 2, 3]); | |
| 37 Should('My array', [0.11, 0.19]).beCloseToArray([0.1, 0.2], 0.02); | |
| 38 Should('My random array', [1, 1, 3, 3, 2]).containValues([1, 3, 2]); | |
| 39 taskDone(); | |
| 40 }); | |
| 41 | |
| 42 audit.runTasks(); | |
|
Raymond Toy
2016/08/04 18:07:08
This is a breaking change. We used to have to hav
hongchan
2016/08/04 18:31:37
Not sure why this is a breaking change. It does no
| |
| 43 </script> | |
| 44 </body> | |
| 45 </html> | |
| OLD | NEW |