Skip to content

Commit 2662635

Browse files
bench: refactor to use string interpolation in assert/contains
PR-URL: #8683 Ref: #8647 Co-authored-by: Athan Reines <[email protected]> Reviewed-by: Athan Reines <[email protected]>
1 parent b527ab1 commit 2662635

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/node_modules/@stdlib/assert/contains/benchmark/benchmark.length.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var bench = require( '@stdlib/bench' );
2424
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2525
var pow = require( '@stdlib/math/base/special/pow' );
26-
var randu = require( '@stdlib/random/base/randu' );
26+
var format = require( '@stdlib/string/format' );
2727
var pkg = require( './../package.json' ).name;
2828
var contains = require( './../lib' );
2929

@@ -61,7 +61,7 @@ function createBenchmark( fcn, len ) {
6161
b.tic();
6262
for ( i = 0; i < b.iterations; i++ ) {
6363
// Note: we are testing the worst case scenario where a function must scan the entire array before finding a value.
64-
x[ len-2 ] = randu();
64+
x[ len-2 ] -= 1;
6565
bool = fcn( x, len-1 );
6666
if ( typeof bool !== 'boolean' ) {
6767
b.fail( 'should return a boolean' );
@@ -98,7 +98,7 @@ function main() {
9898
len = pow( 10, i );
9999

100100
f = createBenchmark( contains, len );
101-
bench( pkg+':len='+len, f );
101+
bench( format( '%s:len=%d', pkg, len ), f );
102102
}
103103
}
104104

0 commit comments

Comments
 (0)