Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 | 47 |
| 48 | 48 |
| 49 // Numerical assertions. | 49 // Numerical assertions. |
| 50 audit.define('numerical-failures', function (task, should) { | 50 audit.define('numerical-failures', function (task, should) { |
| 51 task.describe('Testing numerical assertion failures.'); | 51 task.describe('Testing numerical assertion failures.'); |
| 52 | 52 |
| 53 should(0).beCloseTo(0.1, { threshold: 0 }); | 53 should(0).beCloseTo(0.1, { threshold: 0 }); |
| 54 should(59, 'The measured decibel').beCloseTo(62, { threshold: 0.01 }); | 54 should(59, 'The measured decibel').beCloseTo(62, { threshold: 0.01 }); |
| 55 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5); | 55 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5); |
| 56 should([0, 0, 0]).notBeConstantValueOf(0); | 56 should([0, 0, 0]).notBeConstantValueOf(0); |
| 57 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]) | 57 should([1, 8, 11, 17, 6, 6, 5, 6, 123, 49]) |
| 58 .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]); | 58 .beEqualToArray([1, 8, 9, 18, 6, 5, 6, 5, 123, 48]); |
|
Raymond Toy
2017/01/25 19:42:07
Although there's nothing wrong with this change, b
hongchan
2017/01/25 22:20:33
Done.
| |
| 59 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]); | 59 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]); |
| 60 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04); | 60 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04); |
| 61 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) | 61 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) |
| 62 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { | 62 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { |
| 63 absoluteThreshold: 0.02 | 63 absoluteThreshold: 0.02 |
| 64 }); | 64 }); |
| 65 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) | 65 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) |
| 66 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { | 66 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { |
| 67 relativeThreshold: 0.1 | 67 relativeThreshold: 0.1 |
| 68 }); | 68 }); |
| 69 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) | 69 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) |
| 70 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { | 70 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { |
| 71 absoluteThreshold: 0.02, | 71 absoluteThreshold: 0.02, |
| 72 relativeThreshold: 0.1 | 72 relativeThreshold: 0.1 |
| 73 }); | 73 }); |
| 74 | 74 |
| 75 task.done(); | 75 task.done(); |
| 76 }); | 76 }); |
| 77 | 77 |
| 78 | 78 |
| 79 // With no argument, this executes all tasks in the order defined. | 79 // With no argument, this executes all tasks in the order defined. |
| 80 audit.run(); | 80 audit.run(); |
| 81 </script> | 81 </script> |
| 82 </body> | 82 </body> |
| 83 </html> | 83 </html> |
| OLD | NEW |