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

Side by Side Diff: LayoutTests/inspector/utilities.html

Issue 166703003: DevTools: Simplify mergeOrIntersect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added a test. Fixed findFilesMatchingSearchRequest Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/inspector/utilities-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script> 3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script> 4 <script>
5 5
6 function test() 6 function test()
7 { 7 {
8 InspectorTest.runTestSuite([ 8 InspectorTest.runTestSuite([
9 function orderedMergeIntersect(next)
10 {
11 function comparator(a, b)
12 {
13 return a - b;
14 }
15 function count(a, x)
16 {
17 return a.upperBound(x) - a.lowerBound(x);
18 }
19 function testAll(a, b)
20 {
21 testOperation(a, b, a.mergeOrdered(b, comparator), Math.max, "U" );
22 testOperation(a, b, a.intersectOrdered(b, comparator), Math.min, "x");
23 }
24 function testOperation(a, b, actual, checkOperation, opName)
25 {
26 var allValues = a.concat(b).concat(actual);
27 for (var i = 0; i < allValues.length; ++i) {
28 var value = allValues[i];
29 expectedCount = checkOperation(count(a, value), count(b, val ue));
30 actualCount = count(actual, value);
31 InspectorTest.assertEquals(expectedCount, actualCount,
32 "Incorrect result for value: " + value + " at [" + a + " ] " + opName + " [" + b + "] -> [" + actual + "]");
33 }
34 InspectorTest.assertEquals(JSON.stringify(actual.sort()), JSON.s tringify(actual), "result array is ordered");
35 }
36 var testArrays = [
37 [], [],
38 [1], [],
39 [1, 2, 2, 2, 3], [],
40 [4, 5, 5, 8, 8], [1, 1, 1, 2, 6],
41 [1, 2, 2, 2, 2, 3, 3, 4], [2, 2, 2, 3, 3, 3, 3],
42 [1, 2, 3, 4, 5], [1, 2, 3]
43 ];
44 for (var i = 0; i < testArrays.length; i += 2) {
45 testAll(testArrays[i], testArrays[i + 1]);
46 testAll(testArrays[i + 1], testArrays[i]);
47 }
48 next();
49 },
50
9 function binaryIndexOfTest(next) 51 function binaryIndexOfTest(next)
10 { 52 {
11 var testArrays = [ 53 var testArrays = [
12 [], 54 [],
13 [1], 55 [1],
14 [1, 10], 56 [1, 10],
15 [1, 10, 11, 12, 13, 14, 100], 57 [1, 10, 11, 12, 13, 14, 100],
16 [-100, -50, 0, 50, 100], 58 [-100, -50, 0, 50, 100],
17 [-100, -14, -13, -12, -11, -10, -1] 59 [-100, -14, -13, -12, -11, -10, -1]
18 ]; 60 ];
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 </script> 401 </script>
360 </head> 402 </head>
361 403
362 <body onload="runTest()"> 404 <body onload="runTest()">
363 <p> 405 <p>
364 This test checks Web Inspector utilities. 406 This test checks Web Inspector utilities.
365 </p> 407 </p>
366 408
367 </body> 409 </body>
368 </html> 410 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/inspector/utilities-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698