Skip to content

Commit d8e1142

Browse files
committed
Tests fixed to be compatible with new benchmark utility
1 parent 8076fc6 commit d8e1142

File tree

10 files changed

+29
-20
lines changed

10 files changed

+29
-20
lines changed

JavaScript/3-instantiation.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
const benchmark = require('./2-benchmark.js');
44

5+
function makeClosure(hello, size, flag) {
6+
return () => {};
7+
}
8+
9+
function closureInstance() {
10+
return makeClosure('world', 100500, true);
11+
};
12+
513
function defineArray() {
614
return ['world', 100500, true];
715
}
@@ -76,7 +84,8 @@ function itemFactory(hello, size, flag) {
7684
return { hello, size, flag };
7785
}
7886

79-
benchmark.do(10000000, 5, [
87+
benchmark.do(10000000, [
88+
closureInstance,
8089
defineObject,
8190
defineArray,
8291
defineArrayOfString,

JavaScript/4-array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const query = (person) => (
7979

8080
// Execute tests
8181

82-
benchmark.do(100000, 3, [
82+
benchmark.do(1000000, [
8383
function filterObjects() {
8484
data1.filter(query);
8585
},

JavaScript/5-range.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22

33
const benchmark = require('./2-benchmark.js');
44

5-
benchmark.do(100000, 3, [
6-
function testRangePush() {
7-
rangePush(1, 1000);
8-
},
9-
function testRangeNew() {
10-
rangeNew(1, 1000);
11-
}
12-
]);
13-
145
function rangePush(min, max) {
156
const arr = [];
167
let i;
@@ -47,3 +38,12 @@ function rangeEx(range) {
4738
}
4839
return res;
4940
}
41+
42+
benchmark.do(1000000, [
43+
function testRangePush() {
44+
rangePush(1, 1000);
45+
},
46+
function testRangeNew() {
47+
rangeNew(1, 1000);
48+
}
49+
]);

JavaScript/6-functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function fnDeclarationU() { return; }
2121
function fnDeclarationN() { return null; }
2222
function fnDeclaration0() { return 0; }
2323

24-
benchmark.do(100000000, 3, [
24+
benchmark.do(10000000, [
2525
fnLambdaBlock,
2626
fnLambdaBlockU,
2727
fnLambdaBlockN,

JavaScript/7-includes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function testIncludes() {
2020
];
2121
}
2222

23-
benchmark.do(10000000, 5, [
23+
benchmark.do(10000000, [
2424
testIncludes,
25-
testIndexOf,
25+
testIndexOf
2626
]);

JavaScript/8-for-let.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function testForLet() {
1717
}
1818
}
1919

20-
benchmark.do(1000000, 5, [
20+
benchmark.do(1000000, [
2121
testLetFor,
22-
testForLet,
22+
testForLet
2323
]);

JavaScript/9-for-in.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function testForOfLet() {
6464
}
6565
}
6666

67-
benchmark.do(1000000, 5, [
67+
benchmark.do(1000000, [
6868
testForKeys,
6969
testForIn,
7070
testForInLet,

JavaScript/a-tick-template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function testTick() {
1010
return `Hello user${parseInt('5') * 10} !`;
1111
}
1212

13-
benchmark.do(10000000, 5, [
13+
benchmark.do(10000000, [
1414
testConcat,
1515
testTick
1616
]);

JavaScript/b-es6-map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function testForOfEntries() {
6262
}
6363
}
6464

65-
benchmark.do(1000000, 4, [
65+
benchmark.do(1000000, [
6666
testForInHash,
6767
testForEach,
6868
testForOf,

JavaScript/c-repeat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function testRepeat() {
1010
return '.'.repeat(20);
1111
}
1212

13-
benchmark.do(1000000, 3, [
13+
benchmark.do(1000000, [
1414
testArrayJoin,
1515
testRepeat,
1616
]);

0 commit comments

Comments
 (0)