File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
lib/node_modules/@stdlib/process/cwd/benchmark Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ // MODULES //
4+
5+ var bench = require ( '@stdlib/bench' ) ;
6+ var isString = require ( '@stdlib/assert/is-string' ) . isPrimitive ;
7+ var pkg = require ( './../package.json' ) . name ;
8+ var cwd = require ( './../lib/browser.js' ) ;
9+
10+
11+ // MAIN //
12+
13+ bench ( pkg , function benchmark ( b ) {
14+ var dir ;
15+ var i ;
16+
17+ b . tic ( ) ;
18+ for ( i = 0 ; i < b . iterations ; i ++ ) {
19+ // Note: the following *could* be optimized away via loop-invariant code motion. If so, the entire loop will disappear.
20+ dir = cwd ( ) ;
21+ if ( ! isString ( dir ) ) {
22+ b . fail ( 'should return a string' ) ;
23+ }
24+ }
25+ b . toc ( ) ;
26+ if ( ! isString ( dir ) ) {
27+ b . fail ( 'should return a string' ) ;
28+ }
29+ b . pass ( 'benchmark finished' ) ;
30+ b . end ( ) ;
31+ } ) ;
Original file line number Diff line number Diff line change 44
55var bench = require ( '@stdlib/bench' ) ;
66var isString = require ( '@stdlib/assert/is-string' ) . isPrimitive ;
7+ var IS_BROWSER = require ( '@stdlib/assert/is-browser' ) ;
78var pkg = require ( './../package.json' ) . name ;
89var cwd = require ( './../lib' ) ;
910
1011
12+ // VARIABLES //
13+
14+ var opts = {
15+ 'skip' : IS_BROWSER
16+ } ;
17+
18+
1119// MAIN //
1220
13- bench ( pkg , function benchmark ( b ) {
21+ bench ( pkg , opts , function benchmark ( b ) {
1422 var dir ;
1523 var i ;
1624
You can’t perform that action at this time.
0 commit comments