Skip to content

Commit 35240ca

Browse files
Trottaddaleax
authored andcommitted
test: refactor min() in test-hash-seed
Replace min() function with Math.min(...). PR-URL: #25522 Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
1 parent 779ce29 commit 35240ca

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

‎test/fixtures/guess-hash-seed.js‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
11
'use strict';
2-
functionmin(arr){
3-
letres=arr[0];
4-
for(leti=1;i<arr.length;i++){
5-
constval=arr[i];
6-
if(val<res)
7-
res=val;
8-
}
9-
returnres;
10-
}
112
functionrun_repeated(n,fn){
123
constres=[];
134
for(leti=0;i<n;i++)res.push(fn());
@@ -118,11 +109,11 @@ let tester_set_treshold;
118109

119110
// calibrate Set access times for accessing the full bucket / an empty bucket
120111
constpos_time=
121-
min(run_repeated(10000,time_set_lookup.bind(null,tester_set,
122-
positive_test_value)));
112+
Math.min(...run_repeated(10000,time_set_lookup.bind(null,tester_set,
113+
positive_test_value)));
123114
constneg_time=
124-
min(run_repeated(10000,time_set_lookup.bind(null,tester_set,
125-
negative_test_value)));
115+
Math.min(...run_repeated(10000,time_set_lookup.bind(null,tester_set,
116+
negative_test_value)));
126117
tester_set_treshold=(pos_time+neg_time)/2;
127118
// console.log(`pos_time: ${pos_time}, neg_time: ${neg_time},`,
128119
// `threshold: ${tester_set_treshold}`);

0 commit comments

Comments
 (0)