OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>audit.js: basic tests</title> | 4 <title>audit.js: basic tests</title> |
5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
7 <script src="../resources/audit.js"></script> | 7 <script src="../resources/audit.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <script> | 10 <script> |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 | 40 |
41 // Advanced, mostly array-based numerical testing. Note that some codes | 41 // Advanced, mostly array-based numerical testing. Note that some codes |
42 // are commented out to avoid the trybot failure. These failures are | 42 // are commented out to avoid the trybot failure. These failures are |
43 // intentional, to demonstrate how the detailed failure report works. | 43 // intentional, to demonstrate how the detailed failure report works. |
44 audit.define('numerical', function (task, should) { | 44 audit.define('numerical', function (task, should) { |
45 task.describe('Numerical assertion unit test.'); | 45 task.describe('Numerical assertion unit test.'); |
46 | 46 |
47 should(2.3).beCloseTo(2, { threshold: 0.3 }); | 47 should(2.3).beCloseTo(2, { threshold: 0.3 }); |
48 should([1, 1, 1]).beConstantValueOf(1); | 48 should([1, 1, 1]).beConstantValueOf(1); |
| 49 should([1, 0, 1]).notBeConstantValueOf(1); |
49 should([1, 1, 1]).beEqualToArray([1, 1, 1]); | 50 should([1, 1, 1]).beEqualToArray([1, 1, 1]); |
50 should([1, 1, 1, 1, 2, 2, 3, 3, 3]) | 51 should([1, 1, 1, 1, 2, 2, 3, 3, 3]) |
51 .containValues([1, 2, 3], 'one, two, three'); | 52 .containValues([1, 2, 3], 'one, two, three'); |
52 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06); | 53 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06); |
53 | 54 |
54 task.done(); | 55 task.done(); |
55 }); | 56 }); |
56 | 57 |
57 | 58 |
58 // This task is defined, but you can selectively opt it out when the task | 59 // This task is defined, but you can selectively opt it out when the task |
59 // runs. If you would like to see how failure cases get printed, include | 60 // runs. If you would like to see how failure cases get printed, include |
60 // this task and launch the task runner. | 61 // this task and launch the task runner. |
61 audit.define('empty', function (task, should) { | 62 audit.define('empty', function (task, should) { |
62 task.describe('This is an empty task.'); | 63 task.describe('This is an empty task.'); |
63 | 64 |
64 task.done(); | 65 task.done(); |
65 }); | 66 }); |
66 | 67 |
67 | 68 |
68 // You can enumerate tasks you want to execute in the order, or simply pass | 69 // You can enumerate tasks you want to execute in the order, or simply pass |
69 // no argument to run all the defined tasks. | 70 // no argument to run all the defined tasks. |
70 audit.run('numerical', 'basic'); | 71 audit.run('numerical', 'basic'); |
71 </script> | 72 </script> |
72 </body> | 73 </body> |
73 </html> | 74 </html> |
OLD | NEW |