OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>audit.js: handling failures</title> | 4 <title>audit.js: handling failures</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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 }); | 44 }); |
45 | 45 |
46 | 46 |
47 // Numerical assertions. | 47 // Numerical assertions. |
48 audit.define('numerical-failures', function (task, should) { | 48 audit.define('numerical-failures', function (task, should) { |
49 task.describe('Testing numerical assertion failures.'); | 49 task.describe('Testing numerical assertion failures.'); |
50 | 50 |
51 should(0).beCloseTo(0.1, { threshold: 0 }); | 51 should(0).beCloseTo(0.1, { threshold: 0 }); |
52 should(59, 'The measured decibel').beCloseTo(62, { threshold: 0.01 }); | 52 should(59, 'The measured decibel').beCloseTo(62, { threshold: 0.01 }); |
53 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5); | 53 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5); |
| 54 should([0, 0, 0]).notBeConstantValueOf(0); |
54 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]) | 55 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]) |
55 .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]); | 56 .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]); |
56 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]); | 57 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]); |
57 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04); | 58 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04); |
58 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) | 59 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) |
59 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { | 60 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { |
60 absoluteThreshold: 0.02 | 61 absoluteThreshold: 0.02 |
61 }); | 62 }); |
62 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) | 63 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) |
63 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { | 64 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { |
64 relativeThreshold: 0.1 | 65 relativeThreshold: 0.1 |
65 }); | 66 }); |
66 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) | 67 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) |
67 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { | 68 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { |
68 absoluteThreshold: 0.02, | 69 absoluteThreshold: 0.02, |
69 relativeThreshold: 0.1 | 70 relativeThreshold: 0.1 |
70 }); | 71 }); |
71 | 72 |
72 task.done(); | 73 task.done(); |
73 }); | 74 }); |
74 | 75 |
75 | 76 |
76 // With no argument, this executes all tasks in the order defined. | 77 // With no argument, this executes all tasks in the order defined. |
77 audit.run(); | 78 audit.run(); |
78 </script> | 79 </script> |
79 </body> | 80 </body> |
80 </html> | 81 </html> |
OLD | NEW |