Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/unit-tests/audit.html

Issue 2561573006: Fixing audit.js: should().beCloseTo() and task.run('taskName') (Closed)
Patch Set: Review Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>A simple unit testing for audio-test-utils.js and testharness.js</title > 4 <title>A simple unit testing for audio-test-utils.js and testharness.js</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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 }); 42 });
43 }); 43 });
44 44
45 45
46 // Advanced, mostly array-based numerical testing. Note that some codes 46 // Advanced, mostly array-based numerical testing. Note that some codes
47 // are commented out to avoid the trybot failure. These failures are 47 // are commented out to avoid the trybot failure. These failures are
48 // intentional, to demonstrate how the detailed failure report works. 48 // intentional, to demonstrate how the detailed failure report works.
49 audit.define('numerical', function (task, should) { 49 audit.define('numerical', function (task, should) {
50 task.describe('Numerical assertion unit test.'); 50 task.describe('Numerical assertion unit test.');
51 51
52 should(2.3).beCloseTo(2, { threshold: 0.3 }); 52 should(0).beCloseTo(0, { threshold: 0 });
Raymond Toy 2016/12/08 00:06:02 Rather than modifying this test, I think you shoul
hongchan 2016/12/08 17:52:12 Done.
53
54 should([1, 1, 1]).beConstantValueOf(1); 53 should([1, 1, 1]).beConstantValueOf(1);
55 // should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5);
56
57 should([1, 1, 1]).beEqualToArray([1, 1, 1]); 54 should([1, 1, 1]).beEqualToArray([1, 1, 1]);
58 // should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49])
59 // .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]);
60
61 should([1, 1, 1, 1, 2, 2, 3, 3, 3]) 55 should([1, 1, 1, 1, 2, 2, 3, 3, 3])
62 .containValues([1, 2, 3], 'one, two, three'); 56 .containValues([1, 2, 3], 'one, two, three');
63 // 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.06);
58
59 task.done();
60 });
64 61
65 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.06);
66 // should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04);
67 62
68 // should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9]) 63 // This task is defined, but you can selectively opt it out when the task
69 // .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], { 64 // runs. If you would like to see how failure cases get printed, include
70 // absoluteThreshold: 0.02, 65 // this task and launch the task runner.
71 // relativeThreshold: 0.1 66 audit.define('failures', function (task, should) {
72 // }); 67 task.describe('To demonstrate the failure logging.');
68
69 should(2.3).beCloseTo(2, { threshold: 0.3 });
70 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49]).beConstantValueOf(5);
71 should([1, 8, 11, 18, 6, 5, 5, 5, 123, 49])
72 .beEqualToArray([1, 8, 10, 18, 6, 5, 6, 5, 123, 48]);
73 should([1, 1, 1, 1, 2, 2, 3, 3, 3]).containValues([1, 3, 2]);
74 should([0.5, 0.5, 0.55, 0.5, 0.45, 0.5]).notGlitch(0.04);
75 should([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9])
76 .beCloseToArray([0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1], {
77 absoluteThreshold: 0.02,
78 relativeThreshold: 0.1
79 });
73 80
74 task.done(); 81 task.done();
75 }); 82 });
76 83
77 84
78 audit.run(); 85 audit.run('numerical', 'basic');
Raymond Toy 2016/12/08 00:06:02 I'm ok with this for this CL, but we really need t
hongchan 2016/12/08 17:52:12 Sure. I will add another test (for the failure cas
79 </script> 86 </script>
80 </body> 87 </body>
81 </html> 88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698