| 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 --> | |
| 9 <script src="../../resources/testharness.js"></script> | |
| 10 <script src="../../resources/testharnessreport.js"></script> | |
| 11 <script src="../resources/audit-util.js"></script> | |
| 12 <script src="../resources/audio-testing.js"></script> | |
| 13 | |
| 14 </head> | |
| 15 <body> | |
| 16 <script> | |
| 17 var audit = Audit.createTaskRunner(); | |
| 18 | |
| 19 audit.defineTask('foo', function (taskDone) { | |
| 20 Should('Zero', 0).beEqualTo(0); | |
| 21 Should('One', 1).notBeEqualTo(0); | |
| 22 Should('Expected SNR', 110).beGreaterThanOrEqualTo(100); | |
| 23 taskDone(); | |
| 24 }); | |
| 25 | |
| 26 audit.defineTask('bar', function (taskDone) { | |
| 27 var maxError = 1e-6; | |
| 28 Should("Maximum error value", maxError).beLessThanOrEqualTo(1e-5); | |
| 29 Should('One point double zero one', 1.001).beCloseTo(1, .1); | |
| 30 taskDone(); | |
| 31 }); | |
| 32 | |
| 33 audit.defineTask('boo', function (taskDone) { | |
| 34 Should('[2, 2, 2]', [2, 2, 2]).beConstantValueOf(2); | |
| 35 Should('[1, 2, 3]', [1, 2, 3]).beEqualToArray([1, 2, 3]); | |
| 36 Should('My array', [0.11, 0.19]).beCloseToArray([0.1, 0.2], 0.02); | |
| 37 Should('My random array', [1, 1, 3, 3, 2]).containValues([1, 3, 2]); | |
| 38 taskDone(); | |
| 39 }); | |
| 40 | |
| 41 audit.runTasks(); | |
| 42 </script> | |
| 43 </body> | |
| 44 </html> | |
| OLD | NEW |