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

Side by Side Diff: test/mjsunit/array-reduce.js

Issue 8888006: Make more JS files beter match the coding standard. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 9 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 | Annotate | Revision Log
« no previous file with comments | « test/mjsunit/array-iteration.js ('k') | test/mjsunit/array-slice.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 99
100 function sum(a, b) { return a + b; } 100 function sum(a, b) { return a + b; }
101 function prod(a, b) { return a * b; } 101 function prod(a, b) { return a * b; }
102 function dec(a, b, i, arr) { return a + b * Math.pow(10, arr.length - i - 1); } 102 function dec(a, b, i, arr) { return a + b * Math.pow(10, arr.length - i - 1); }
103 function accumulate(acc, elem, i) { acc[i] = elem; return acc; } 103 function accumulate(acc, elem, i) { acc[i] = elem; return acc; }
104 104
105 // ---- Test Reduce[Left] 105 // ---- Test Reduce[Left]
106 106
107 var simpleArray = [2,4,6] 107 var simpleArray = [2,4,6];
108 108
109 testReduce("reduce", "SimpleReduceSum", 12, 109 testReduce("reduce", "SimpleReduceSum", 12,
110 [[0, 2, 0, simpleArray, 2], 110 [[0, 2, 0, simpleArray, 2],
111 [2, 4, 1, simpleArray, 6], 111 [2, 4, 1, simpleArray, 6],
112 [6, 6, 2, simpleArray, 12]], 112 [6, 6, 2, simpleArray, 12]],
113 simpleArray, sum, 0); 113 simpleArray, sum, 0);
114 114
115 testReduce("reduce", "SimpleReduceProd", 48, 115 testReduce("reduce", "SimpleReduceProd", 48,
116 [[1, 2, 0, simpleArray, 2], 116 [[1, 2, 0, simpleArray, 2],
117 [2, 4, 1, simpleArray, 8], 117 [2, 4, 1, simpleArray, 8],
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 return a + b; 514 return a + b;
515 } 515 }
516 516
517 var arr = [1, 2, 3, 4]; 517 var arr = [1, 2, 3, 4];
518 testReduce("reduce", "ArrayManipulationExtender", 10, 518 testReduce("reduce", "ArrayManipulationExtender", 10,
519 [[0, 1, 0, [1, 2, 3, 4], 1], 519 [[0, 1, 0, [1, 2, 3, 4], 1],
520 [1, 2, 1, [1, 2, 3, 4, 4], 3], 520 [1, 2, 1, [1, 2, 3, 4, 4], 3],
521 [3, 3, 2, [1, 2, 3, 4, 4, 5], 6], 521 [3, 3, 2, [1, 2, 3, 4, 4, 5], 6],
522 [6, 4, 3, [1, 2, 3, 4, 4, 5, 6], 10], 522 [6, 4, 3, [1, 2, 3, 4, 4, 5, 6], 10],
523 ], arr, extender, 0); 523 ], arr, extender, 0);
OLDNEW
« no previous file with comments | « test/mjsunit/array-iteration.js ('k') | test/mjsunit/array-slice.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698