From a76cbb78cc586d135b04d48b31cf3ddc55ca66fa Mon Sep 17 00:00:00 2001 From: kgryte <2643044+kgryte@users.noreply.github.com> Date: Mon, 9 Mar 2026 03:10:45 +0000 Subject: [PATCH] chore: cleanup coverage directories Signed-off-by: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> --- bench/harness/benchmark-class/assert.js.html | 289 ---- .../benchmark-class/clear_timeout.js.html | 154 --- bench/harness/benchmark-class/comment.js.html | 256 ---- bench/harness/benchmark-class/coverage.ndjson | 1 - .../benchmark-class/deep_equal.js.html | 208 --- bench/harness/benchmark-class/end.js.html | 259 ---- bench/harness/benchmark-class/ended.js.html | 196 --- bench/harness/benchmark-class/equal.js.html | 217 --- bench/harness/benchmark-class/exit.js.html | 235 ---- bench/harness/benchmark-class/fail.js.html | 205 --- bench/harness/benchmark-class/index.html | 386 ------ bench/harness/benchmark-class/index.js.html | 1210 ----------------- .../benchmark-class/not_deep_equal.js.html | 208 --- .../harness/benchmark-class/not_equal.js.html | 217 --- bench/harness/benchmark-class/not_ok.js.html | 214 --- bench/harness/benchmark-class/ok.js.html | 214 --- bench/harness/benchmark-class/pass.js.html | 205 --- bench/harness/benchmark-class/run.js.html | 322 ----- .../benchmark-class/set_timeout.js.html | 154 --- bench/harness/benchmark-class/skip.js.html | 211 --- bench/harness/benchmark-class/todo.js.html | 211 --- bench/harness/harness/coverage.ndjson | 1 - bench/harness/harness/index.html | 116 -- bench/harness/harness/iterations.js.html | 403 ------ bench/harness/log/coverage.ndjson | 1 - bench/harness/log/index.html | 131 -- bench/harness/log/index.js.html | 367 ----- bench/harness/log/log.js.html | 193 --- bench/harness/runner/clear.js.html | 193 --- bench/harness/runner/close.js.html | 304 ----- bench/harness/runner/coverage.ndjson | 1 - bench/harness/runner/create_stream.js.html | 652 --------- bench/harness/runner/encode_assertion.js.html | 448 ------ bench/harness/runner/encode_result.js.html | 232 ---- bench/harness/runner/exit.js.html | 244 ---- bench/harness/runner/index.html | 236 ---- bench/harness/runner/index.js.html | 733 ---------- bench/harness/runner/push.js.html | 385 ------ bench/harness/runner/run.js.html | 193 --- bench/harness/utils/can_emit_exit.js.html | 187 --- bench/harness/utils/can_exit.js.html | 184 --- bench/harness/utils/coverage.ndjson | 1 - bench/harness/utils/index.html | 161 --- bench/harness/utils/next_tick.js.html | 217 --- bench/harness/utils/process.js.html | 169 --- .../lib/coverage.ndjson | 5 - .../is-column-major-string/lib/index.html | 131 -- .../is-column-major-string/lib/index.js.html | 223 --- .../is-column-major-string/lib/main.js.html | 223 --- .../ndarraylike2scalar/lib/coverage.ndjson | 5 - ndarray/ndarraylike2scalar/lib/index.html | 131 -- ndarray/ndarraylike2scalar/lib/index.js.html | 217 --- ndarray/ndarraylike2scalar/lib/main.js.html | 265 ---- ndarray/normalize-index/lib/coverage.ndjson | 5 - ndarray/normalize-index/lib/index.html | 131 -- ndarray/normalize-index/lib/index.js.html | 223 --- ndarray/normalize-index/lib/main.js.html | 256 ---- ndarray/shape2strides/lib/assign.js.html | 394 ------ ndarray/shape2strides/lib/coverage.ndjson | 5 - ndarray/shape2strides/lib/index.html | 146 -- ndarray/shape2strides/lib/index.js.html | 235 ---- ndarray/shape2strides/lib/main.js.html | 391 ------ ndarray/strides2offset/lib/coverage.ndjson | 5 - ndarray/strides2offset/lib/index.html | 131 -- ndarray/strides2offset/lib/index.js.html | 214 --- ndarray/strides2offset/lib/main.js.html | 253 ---- 66 files changed, 14913 deletions(-) delete mode 100644 bench/harness/benchmark-class/assert.js.html delete mode 100644 bench/harness/benchmark-class/clear_timeout.js.html delete mode 100644 bench/harness/benchmark-class/comment.js.html delete mode 100644 bench/harness/benchmark-class/coverage.ndjson delete mode 100644 bench/harness/benchmark-class/deep_equal.js.html delete mode 100644 bench/harness/benchmark-class/end.js.html delete mode 100644 bench/harness/benchmark-class/ended.js.html delete mode 100644 bench/harness/benchmark-class/equal.js.html delete mode 100644 bench/harness/benchmark-class/exit.js.html delete mode 100644 bench/harness/benchmark-class/fail.js.html delete mode 100644 bench/harness/benchmark-class/index.html delete mode 100644 bench/harness/benchmark-class/index.js.html delete mode 100644 bench/harness/benchmark-class/not_deep_equal.js.html delete mode 100644 bench/harness/benchmark-class/not_equal.js.html delete mode 100644 bench/harness/benchmark-class/not_ok.js.html delete mode 100644 bench/harness/benchmark-class/ok.js.html delete mode 100644 bench/harness/benchmark-class/pass.js.html delete mode 100644 bench/harness/benchmark-class/run.js.html delete mode 100644 bench/harness/benchmark-class/set_timeout.js.html delete mode 100644 bench/harness/benchmark-class/skip.js.html delete mode 100644 bench/harness/benchmark-class/todo.js.html delete mode 100644 bench/harness/harness/coverage.ndjson delete mode 100644 bench/harness/harness/index.html delete mode 100644 bench/harness/harness/iterations.js.html delete mode 100644 bench/harness/log/coverage.ndjson delete mode 100644 bench/harness/log/index.html delete mode 100644 bench/harness/log/index.js.html delete mode 100644 bench/harness/log/log.js.html delete mode 100644 bench/harness/runner/clear.js.html delete mode 100644 bench/harness/runner/close.js.html delete mode 100644 bench/harness/runner/coverage.ndjson delete mode 100644 bench/harness/runner/create_stream.js.html delete mode 100644 bench/harness/runner/encode_assertion.js.html delete mode 100644 bench/harness/runner/encode_result.js.html delete mode 100644 bench/harness/runner/exit.js.html delete mode 100644 bench/harness/runner/index.html delete mode 100644 bench/harness/runner/index.js.html delete mode 100644 bench/harness/runner/push.js.html delete mode 100644 bench/harness/runner/run.js.html delete mode 100644 bench/harness/utils/can_emit_exit.js.html delete mode 100644 bench/harness/utils/can_exit.js.html delete mode 100644 bench/harness/utils/coverage.ndjson delete mode 100644 bench/harness/utils/index.html delete mode 100644 bench/harness/utils/next_tick.js.html delete mode 100644 bench/harness/utils/process.js.html delete mode 100644 ndarray/assert/is-column-major-string/lib/coverage.ndjson delete mode 100644 ndarray/assert/is-column-major-string/lib/index.html delete mode 100644 ndarray/assert/is-column-major-string/lib/index.js.html delete mode 100644 ndarray/assert/is-column-major-string/lib/main.js.html delete mode 100644 ndarray/ndarraylike2scalar/lib/coverage.ndjson delete mode 100644 ndarray/ndarraylike2scalar/lib/index.html delete mode 100644 ndarray/ndarraylike2scalar/lib/index.js.html delete mode 100644 ndarray/ndarraylike2scalar/lib/main.js.html delete mode 100644 ndarray/normalize-index/lib/coverage.ndjson delete mode 100644 ndarray/normalize-index/lib/index.html delete mode 100644 ndarray/normalize-index/lib/index.js.html delete mode 100644 ndarray/normalize-index/lib/main.js.html delete mode 100644 ndarray/shape2strides/lib/assign.js.html delete mode 100644 ndarray/shape2strides/lib/coverage.ndjson delete mode 100644 ndarray/shape2strides/lib/index.html delete mode 100644 ndarray/shape2strides/lib/index.js.html delete mode 100644 ndarray/shape2strides/lib/main.js.html delete mode 100644 ndarray/strides2offset/lib/coverage.ndjson delete mode 100644 ndarray/strides2offset/lib/index.html delete mode 100644 ndarray/strides2offset/lib/index.js.html delete mode 100644 ndarray/strides2offset/lib/main.js.html diff --git a/bench/harness/benchmark-class/assert.js.html b/bench/harness/benchmark-class/assert.js.html deleted file mode 100644 index 71436e7e26e..00000000000 --- a/bench/harness/benchmark-class/assert.js.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - -
-- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -184x -184x -184x -184x -184x -184x -184x -184x -184x -184x -184x -184x -184x -96x -96x -184x -96x -96x -184x -64x -64x -64x -64x -64x -184x -184x -184x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-/* eslint-disable no-invalid-this */
-
-'use strict';
-
-// MODULES //
-
-var hasOwnProp = require( '@stdlib/assert/has-own-property' );
-
-
-// MAIN //
-
-/**
-* Generates an assertion.
-*
-* @private
-* @param {boolean} ok - assertion outcome
-* @param {Options} opts - options
-*/
-function assert( ok, opts ) {
- var result;
- var err;
-
- result = {
- 'id': this._count,
- 'ok': ok,
- 'skip': opts.skip,
- 'todo': opts.todo,
- 'name': opts.message || '(unnamed assert)',
- 'operator': opts.operator
- };
- if ( hasOwnProp( opts, 'actual' ) ) {
- result.actual = opts.actual;
- }
- if ( hasOwnProp( opts, 'expected' ) ) {
- result.expected = opts.expected;
- }
- if ( !ok ) {
- result.error = opts.error || new Error( this.name );
- err = new Error( 'not implemented' ); // eslint-disable-line no-unused-vars
-
- // TODO: generate an exception in order to locate the calling function (https://github.com/substack/tape/blob/master/lib/test.js#L215)
- }
- this._count += 1;
- this.emit( 'result', result );
-}
-
-
-// EXPORTS //
-
-module.exports = assert;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// EXPORTS // - -module.exports = clearTimeout; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -5x -5x -5x -5x -5x -5x -5x -5x -5x -5x -5x -5x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var trim = require( '@stdlib/string/base/trim' );
-var replace = require( '@stdlib/string/base/replace' );
-var EOL = require( '@stdlib/regexp/eol' ).REGEXP;
-
-
-// VARIABLES //
-
-var RE_COMMENT = /^#\s*/;
-
-
-// MAIN //
-
-/**
-* Writes a comment.
-*
-* @private
-* @param {string} msg - comment message
-*/
-function comment( msg ) {
- /* eslint-disable no-invalid-this */
- var lines;
- var i;
- msg = trim( msg );
- lines = msg.split( EOL );
- for ( i = 0; i < lines.length; i++ ) {
- msg = trim( lines[ i ] );
- msg = replace( msg, RE_COMMENT, '' );
- this.emit( 'result', msg );
- }
-}
-
-
-// EXPORTS //
-
-module.exports = comment;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - - - - - - -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Asserts that `actual` is deeply equal to `expected`.
-*
-* @private
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] message
-*/
-function deepEqual( actual, expected, msg ) {
- /* eslint-disable no-invalid-this */
- this.comment( 'actual: '+actual+'. expected: '+expected+'. msg: '+msg+'.' );
-
- // TODO: implement
-}
-
-
-// EXPORTS //
-
-module.exports = deepEqual;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -41x -41x -41x -41x - -41x -41x -41x -41x -41x -41x -41x -41x -41x -41x -41x -41x -41x -41x -41x -41x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var nextTick = require( './../utils/next_tick.js' );
-
-
-// MAIN //
-
-/**
-* Ends a benchmark.
-*
-* @private
-*/
-function end() {
- /* eslint-disable no-invalid-this */
- var self = this;
- if ( this._ended ) {
- this.fail( '.end() called more than once' );
- } else {
- // Prevents releasing the zalgo when running synchronous benchmarks.
- nextTick( onTick );
- }
- this._ended = true;
- this._running = false;
-
- /**
- * Callback invoked upon a subsequent tick of the event loop.
- *
- * @private
- */
- function onTick() {
- self.emit( 'end' );
- }
-}
-
-
-// EXPORTS //
-
-module.exports = end;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -32x -32x -32x -32x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Returns a `boolean` indicating if a benchmark has ended.
-*
-* @private
-* @returns {boolean} boolean indicating if a benchmark has ended
-*/
-function ended() {
- /* eslint-disable no-invalid-this */
- return this._ended;
-}
-
-
-// EXPORTS //
-
-module.exports = ended;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -17x -17x -17x -17x -17x -17x -17x -17x -17x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Asserts that `actual` is strictly equal to `expected`.
-*
-* @private
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] - message
-*/
-function equal( actual, expected, msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( actual === expected, {
- 'message': msg || 'should be equal',
- 'operator': 'equal',
- 'expected': expected,
- 'actual': actual
- });
-}
-
-
-// EXPORTS //
-
-module.exports = equal;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - - - -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Forcefully ends a benchmark.
-*
-* @private
-* @returns {void}
-*/
-function exit() {
- /* eslint-disable no-invalid-this */
- if ( this._exited ) {
- // If we have already "exited", do not create more failing assertions when one should suffice...
- return;
- }
- // Only "exit" when a benchmark has either not yet been run or is currently running. If a benchmark has already ended, no need to generate a failing assertion.
- if ( !this._ended ) {
- this._exited = true;
- this.fail( 'benchmark exited without ending' );
-
- // Allow running benchmarks to call `end` on their own...
- if ( !this._running ) {
- this.end();
- }
- }
-}
-
-
-// EXPORTS //
-
-module.exports = exit;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -17x -17x -17x -17x -17x -17x -17x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Generates a failing assertion.
-*
-* @private
-* @param {string} msg - message
-*/
-function fail( msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( false, {
- 'message': msg,
- 'operator': 'fail'
- });
-}
-
-
-// EXPORTS //
-
-module.exports = fail;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
|---|---|---|---|---|---|---|---|---|---|
| assert.js | -
-
- |
- 100% | -68/68 | -83.33% | -5/6 | -100% | -1/1 | -100% | -68/68 | -
| clear_timeout.js | -
-
- |
- 100% | -23/23 | -100% | -1/1 | -100% | -0/0 | -100% | -23/23 | -
| comment.js | -
-
- |
- 100% | -57/57 | -100% | -2/2 | -100% | -1/1 | -100% | -57/57 | -
| deep_equal.js | -
-
- |
- 85.36% | -35/41 | -100% | -1/1 | -0% | -0/1 | -85.36% | -35/41 | -
| end.js | -
-
- |
- 98.27% | -57/58 | -75% | -3/4 | -100% | -2/2 | -98.27% | -57/58 | -
| ended.js | -
-
- |
- 100% | -37/37 | -100% | -2/2 | -100% | -1/1 | -100% | -37/37 | -
| equal.js | -
-
- |
- 100% | -44/44 | -66.66% | -2/3 | -100% | -1/1 | -100% | -44/44 | -
| exit.js | -
-
- |
- 94% | -47/50 | -66.66% | -2/3 | -100% | -1/1 | -94% | -47/50 | -
| fail.js | -
-
- |
- 100% | -40/40 | -100% | -2/2 | -100% | -1/1 | -100% | -40/40 | -
| index.js | -
-
- |
- 98.13% | -368/375 | -50% | -4/8 | -100% | -3/3 | -98.13% | -368/375 | -
| not_deep_equal.js | -
-
- |
- 85.36% | -35/41 | -100% | -1/1 | -0% | -0/1 | -85.36% | -35/41 | -
| not_equal.js | -
-
- |
- 79.54% | -35/44 | -100% | -1/1 | -0% | -0/1 | -79.54% | -35/44 | -
| not_ok.js | -
-
- |
- 79.06% | -34/43 | -100% | -1/1 | -0% | -0/1 | -79.06% | -34/43 | -
| ok.js | -
-
- |
- 100% | -43/43 | -66.66% | -2/3 | -100% | -1/1 | -100% | -43/43 | -
| pass.js | -
-
- |
- 100% | -40/40 | -100% | -2/2 | -100% | -1/1 | -100% | -40/40 | -
| run.js | -
-
- |
- 89.87% | -71/79 | -60% | -3/5 | -66.66% | -2/3 | -89.87% | -71/79 | -
| set_timeout.js | -
-
- |
- 100% | -23/23 | -100% | -1/1 | -100% | -0/0 | -100% | -23/23 | -
| skip.js | -
-
- |
- 100% | -42/42 | -100% | -2/2 | -100% | -1/1 | -100% | -42/42 | -
| todo.js | -
-
- |
- 100% | -42/42 | -100% | -2/2 | -100% | -1/1 | -100% | -42/42 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -45x -45x -45x -45x -45x -45x - - -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -45x -39x - -39x -39x -39x -39x -39x -39x -45x -45x -45x -45x -45x -45x -45x -45x -39x -39x -39x -39x -39x -39x - - -39x -39x - - -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -45x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var EventEmitter = require( 'events' ).EventEmitter;
-var inherit = require( '@stdlib/utils/inherit' );
-var defineProperty = require( '@stdlib/utils/define-property' );
-var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
-var tic = require( '@stdlib/time/tic' );
-var toc = require( '@stdlib/time/toc' );
-var run = require( './run.js' );
-var exit = require( './exit.js' );
-var ended = require( './ended.js' );
-var assert = require( './assert.js' );
-var comment = require( './comment.js' );
-var skip = require( './skip.js' );
-var todo = require( './todo.js' );
-var fail = require( './fail.js' );
-var pass = require( './pass.js' );
-var ok = require( './ok.js' );
-var notOk = require( './not_ok.js' );
-var equal = require( './equal.js' );
-var notEqual = require( './not_equal.js' );
-var deepEqual = require( './deep_equal.js' );
-var notDeepEqual = require( './not_deep_equal.js' );
-var end = require( './end.js' );
-
-
-// MAIN //
-
-/**
-* Benchmark constructor.
-*
-* @constructor
-* @param {string} name - benchmark name
-* @param {Options} opts - benchmark options
-* @param {boolean} opts.skip - boolean indicating whether to skip a benchmark
-* @param {PositiveInteger} opts.iterations - number of iterations
-* @param {PositiveInteger} opts.timeout - number of milliseconds before a benchmark automatically fails
-* @param {Function} [benchmark] - function containing benchmark code
-* @returns {Benchmark} Benchmark instance
-*
-* @example
-* var bench = new Benchmark( 'beep', function benchmark( b ) {
-* var x;
-* var i;
-* b.comment( 'Running benchmarks...' );
-* b.tic();
-* for ( i = 0; i < b.iterations; i++ ) {
-* x = Math.sin( Math.random() );
-* if ( x !== x ) {
-* b.ok( false, 'should not return NaN' );
-* }
-* }
-* b.toc();
-* if ( x !== x ) {
-* b.ok( false, 'should not return NaN' );
-* }
-* b.comment( 'Finished running benchmarks.' );
-* b.end();
-* });
-*/
-function Benchmark( name, opts, benchmark ) {
- var hasTicked;
- var hasTocked;
- var self;
- var time;
- if ( !( this instanceof Benchmark ) ) {
- return new Benchmark( name, opts, benchmark );
- }
- self = this;
- hasTicked = false;
- hasTocked = false;
-
- EventEmitter.call( this );
-
- // Private properties:
- setReadOnly( this, '_benchmark', benchmark );
- setReadOnly( this, '_skip', opts.skip );
-
- defineProperty( this, '_ended', {
- 'configurable': false,
- 'enumerable': false,
- 'writable': true,
- 'value': false
- });
-
- defineProperty( this, '_running', {
- 'configurable': false,
- 'enumerable': false,
- 'writable': true,
- 'value': false
- });
-
- defineProperty( this, '_exited', {
- 'configurable': false,
- 'enumerable': false,
- 'writable': true,
- 'value': false
- });
-
- defineProperty( this, '_count', {
- 'configurable': false,
- 'enumerable': false,
- 'writable': true,
- 'value': 0
- });
-
- // Read-only:
- setReadOnly( this, 'name', name );
- setReadOnly( this, 'tic', start );
- setReadOnly( this, 'toc', stop );
- setReadOnly( this, 'iterations', opts.iterations );
- setReadOnly( this, 'timeout', opts.timeout );
-
- return this;
-
- /**
- * Starts a benchmark timer.
- *
- * ## Notes
- *
- * - Using a scoped variable prevents nefarious mutation by bad actors hoping to manipulate benchmark results.
- * - The one attack vector which remains is manipulation of the `require` cache for `tic` and `toc`.
- * - One way to combat cache manipulation is by comparing the checksum of `Function#toString()` against known values.
- *
- * @private
- */
- function start() {
- if ( hasTicked ) {
- self.fail( '.tic() called more than once' );
- } else {
- self.emit( 'tic' );
- hasTicked = true;
- time = tic();
- }
- }
-
- /**
- * Stops a benchmark timer.
- *
- * @private
- * @returns {void}
- */
- function stop() {
- var elapsed;
- var secs;
- var rate;
- var out;
-
- if ( hasTicked === false ) {
- return self.fail( '.toc() called before .tic()' );
- }
- elapsed = toc( time );
- if ( hasTocked ) {
- return self.fail( '.toc() called more than once' );
- }
- hasTocked = true;
- self.emit( 'toc' );
-
- secs = elapsed[ 0 ] + ( elapsed[ 1 ]/1e9 );
- rate = self.iterations / secs;
-
- out = {
- 'ok': true,
- 'operator': 'result',
- 'iterations': self.iterations,
- 'elapsed': secs,
- 'rate': rate
- };
- self.emit( 'result', out );
- }
-}
-
-/*
-* Inherit from the `EventEmitter` prototype.
-*/
-inherit( Benchmark, EventEmitter );
-
-/**
-* Runs a benchmark.
-*
-* @private
-* @name run
-* @memberof Benchmark.prototype
-* @type {Function}
-*/
-setReadOnly( Benchmark.prototype, 'run', run );
-
-/**
-* Forcefully ends a benchmark.
-*
-* @private
-* @name exit
-* @memberof Benchmark.prototype
-* @type {Function}
-*/
-setReadOnly( Benchmark.prototype, 'exit', exit );
-
-/**
-* Returns a `boolean` indicating if a benchmark has ended.
-*
-* @private
-* @name ended
-* @memberof Benchmark.prototype
-* @type {Function}
-* @returns {boolean} boolean indicating if a benchmark has ended
-*/
-setReadOnly( Benchmark.prototype, 'ended', ended );
-
-/**
-* Generates an assertion.
-*
-* @private
-* @name _assert
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {boolean} ok - assertion outcome
-* @param {Options} opts - options
-*/
-setReadOnly( Benchmark.prototype, '_assert', assert );
-
-/**
-* Writes a comment.
-*
-* @name comment
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {string} msg - comment message
-*/
-setReadOnly( Benchmark.prototype, 'comment', comment );
-
-/**
-* Generates an assertion which will be skipped.
-*
-* @name skip
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} value - value
-* @param {string} msg - message
-*/
-setReadOnly( Benchmark.prototype, 'skip', skip );
-
-/**
-* Generates an assertion which should be implemented.
-*
-* @name todo
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} value - value
-* @param {string} msg - message
-*/
-setReadOnly( Benchmark.prototype, 'todo', todo );
-
-/**
-* Generates a failing assertion.
-*
-* @name fail
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {string} msg - message
-*/
-setReadOnly( Benchmark.prototype, 'fail', fail );
-
-/**
-* Generates a passing assertion.
-*
-* @name pass
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {string} msg - message
-*/
-setReadOnly( Benchmark.prototype, 'pass', pass );
-
-/**
-* Asserts that a `value` is truthy.
-*
-* @name ok
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} value - value
-* @param {string} [msg] - message
-*/
-setReadOnly( Benchmark.prototype, 'ok', ok );
-
-/**
-* Asserts that a `value` is falsy.
-*
-* @name notOk
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} value - value
-* @param {string} [msg] - message
-*/
-setReadOnly( Benchmark.prototype, 'notOk', notOk );
-
-/**
-* Asserts that `actual` is strictly equal to `expected`.
-*
-* @name equal
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] - message
-*/
-setReadOnly( Benchmark.prototype, 'equal', equal );
-
-/**
-* Asserts that `actual` is not strictly equal to `expected`.
-*
-* @name notEqual
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] - message
-*/
-setReadOnly( Benchmark.prototype, 'notEqual', notEqual );
-
-/**
-* Asserts that `actual` is deeply equal to `expected`.
-*
-* @name deepEqual
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] message
-*/
-setReadOnly( Benchmark.prototype, 'deepEqual', deepEqual );
-
-/**
-* Asserts that `actual` is not deeply equal to `expected`.
-*
-* @name notDeepEqual
-* @memberof Benchmark.prototype
-* @type {Function}
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] message
-*/
-setReadOnly( Benchmark.prototype, 'notDeepEqual', notDeepEqual );
-
-/**
-* Ends a benchmark.
-*
-* @name end
-* @memberof Benchmark.prototype
-* @type {Function}
-*/
-setReadOnly( Benchmark.prototype, 'end', end );
-
-
-// EXPORTS //
-
-module.exports = Benchmark;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - - - - - - -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Asserts that `actual` is not deeply equal to `expected`.
-*
-* @private
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] message
-*/
-function notDeepEqual( actual, expected, msg ) {
- /* eslint-disable no-invalid-this */
- this.comment( 'actual: '+actual+'. expected: '+expected+'. msg: '+msg+'.' );
-
- // TODO: implement
-}
-
-
-// EXPORTS //
-
-module.exports = notDeepEqual;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - - - - - - - - - -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Asserts that `actual` is not strictly equal to `expected`.
-*
-* @private
-* @param {*} actual - actual value
-* @param {*} expected - expected value
-* @param {string} [msg] - message
-*/
-function notEqual( actual, expected, msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( actual !== expected, {
- 'message': msg || 'should not be equal',
- 'operator': 'notEqual',
- 'expected': expected,
- 'actual': actual
- });
-}
-
-
-// EXPORTS //
-
-module.exports = notEqual;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - - - - - - - - - -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Asserts that a `value` is falsy.
-*
-* @private
-* @param {*} value - value
-* @param {string} [msg] - message
-*/
-function notOk( value, msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( !value, {
- 'message': msg || 'should be falsy',
- 'operator': 'notOk',
- 'expected': false,
- 'actual': value
- });
-}
-
-
-// EXPORTS //
-
-module.exports = notOk;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -79x -79x -79x -79x -79x -79x -79x -79x -79x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Asserts that a `value` is truthy.
-*
-* @private
-* @param {*} value - value
-* @param {string} [msg] - message
-*/
-function ok( value, msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( !!value, {
- 'message': msg || 'should be truthy',
- 'operator': 'ok',
- 'expected': true,
- 'actual': value
- });
-}
-
-
-// EXPORTS //
-
-module.exports = ok;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -8x -8x -8x -8x -8x -8x -8x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Generates a passing assertion.
-*
-* @private
-* @param {string} msg - message
-*/
-function pass( msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( true, {
- 'message': msg,
- 'operator': 'pass'
- });
-}
-
-
-// EXPORTS //
-
-module.exports = pass;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -39x -39x -39x -39x -39x - - - -39x - - - -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x - - -39x -39x -39x -39x -39x -39x -39x -39x -39x -39x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var timeout = require( './set_timeout.js' );
-var clear = require( './clear_timeout.js' );
-
-
-// MAIN //
-
-/**
-* Runs a benchmark.
-*
-* @private
-* @returns {void}
-*/
-function run() {
- /* eslint-disable no-invalid-this */
- var self;
- var id;
- if ( this._skip ) {
- this.comment( 'SKIP '+this.name );
- return this.end();
- }
- if ( !this._benchmark ) {
- this.comment( 'TODO '+this.name );
- return this.end();
- }
- self = this;
- this._running = true;
-
- id = timeout( onTimeout, this.timeout );
- this.once( 'end', endTimeout );
-
- this.emit( 'prerun' );
- this._benchmark( this );
- this.emit( 'run' );
-
- /**
- * Callback invoked once a timeout ends.
- *
- * @private
- */
- function onTimeout() {
- self.fail( 'benchmark timed out after '+self.timeout+'ms' );
- }
-
- /**
- * Clears a timeout.
- *
- * @private
- */
- function endTimeout() {
- clear( id );
- }
-}
-
-
-// EXPORTS //
-
-module.exports = run;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// EXPORTS // - -module.exports = setTimeout; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -31x -31x -31x -31x -31x -31x -31x -31x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Generates an assertion which will be skipped.
-*
-* @private
-* @param {*} value - value
-* @param {string} msg - message
-*/
-function skip( value, msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( true, {
- 'message': msg,
- 'operator': 'skip',
- 'skip': true
- });
-}
-
-
-// EXPORTS //
-
-module.exports = skip;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -32x -32x -32x -32x -32x -32x -32x -32x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Generates an assertion which should be implemented.
-*
-* @private
-* @param {*} value - value
-* @param {string} msg - message
-*/
-function todo( value, msg ) {
- /* eslint-disable no-invalid-this */
- this._assert( !!value, {
- 'message': msg,
- 'operator': 'todo',
- 'todo': true
- });
-}
-
-
-// EXPORTS //
-
-module.exports = todo;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
|---|---|---|---|---|---|---|---|---|---|
| iterations.js | -
-
- |
- 100% | -106/106 | -100% | -10/10 | -100% | -4/4 | -100% | -106/106 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -7x -7x -7x -7x -7x -2x -2x -2x -2x -2x -2x -2x -2x -25x -7x -7x -25x -2x -2x -2x -2x -2x -2x -2x -2x -7x -7x -5x -7x -5x -5x -5x -2x -7x -2x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
-var copy = require( '@stdlib/utils/copy' );
-var Benchmark = require( './../benchmark-class' );
-
-
-// VARIABLES //
-
-var MIN_TIME = 0.1; // seconds
-var ITERATIONS = 10; // 10^1
-var MAX_ITERATIONS = 10000000000; // 10^10
-
-
-// MAIN //
-
-/**
-* Determines the number of iterations.
-*
-* @private
-* @param {string} name - benchmark name
-* @param {Options} options - benchmark options
-* @param {(Function|undefined)} benchmark - function containing benchmark code
-* @param {Callback} clbk - callback to invoke after determining number of iterations
-* @returns {void}
-*/
-function iterations( name, options, benchmark, clbk ) {
- var opts;
- var time;
-
- // Elapsed time (in seconds):
- time = 0;
-
- // Create a local copy:
- opts = copy( options );
- opts.iterations = ITERATIONS;
-
- // Begin running benchmarks:
- return next();
-
- /**
- * Run a new benchmark.
- *
- * @private
- */
- function next() {
- var b = new Benchmark( name, opts, benchmark );
- b.on( 'result', onResult );
- b.once( 'end', onEnd );
- b.run();
- }
-
- /**
- * Callback invoked upon a `result` event.
- *
- * @private
- * @param {(string|Object)} result - result
- */
- function onResult( result ) {
- if ( !isString( result ) && result.operator === 'result' ) {
- time = result.elapsed;
- }
- }
-
- /**
- * Callback invoked upon an `end` event.
- *
- * @private
- * @returns {void}
- */
- function onEnd() {
- if (
- time < MIN_TIME &&
- opts.iterations < MAX_ITERATIONS
- ) {
- opts.iterations *= 10;
- return next();
- }
- clbk( null, opts.iterations );
- }
-}
-
-
-// EXPORTS //
-
-module.exports = iterations;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 | 4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -13x -13x -13x -13x -59x -59x -15x -59x -44x -44x -59x -13x -13x -4x -4x -4x -4x -4x -4x -4x -4x -4x -17x -17x -17x -3x -3x -17x -17x -2x -2x -17x -4x -4x -4x -4x -4x -4x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var TransformStream = require( '@stdlib/streams/node/transform' ); // eslint-disable-line stdlib/no-redeclare
-var fromCodePoint = require( '@stdlib/string/from-code-point' );
-var log = require( './log.js' );
-
-
-// MAIN //
-
-/**
-* Returns a Transform stream for logging to the console.
-*
-* @private
-* @returns {TransformStream} transform stream
-*/
-function createStream() {
- var stream;
- var line;
-
- stream = new TransformStream({
- 'transform': transform,
- 'flush': flush
- });
- line = '';
-
- return stream;
-
- /**
- * Callback invoked upon receiving a new chunk.
- *
- * @private
- * @param {(Buffer|string)} chunk - chunk
- * @param {string} enc - Buffer encoding
- * @param {Callback} clbk - callback to invoke after transforming the streamed chunk
- */
- function transform( chunk, enc, clbk ) {
- var c;
- var i;
-
- for ( i = 0; i < chunk.length; i++ ) {
- c = fromCodePoint( chunk[ i ] );
- if ( c === '\n' ) {
- flush();
- } else {
- line += c;
- }
- }
- clbk();
- }
-
- /**
- * Callback to flush data to `stdout`.
- *
- * @private
- * @param {Callback} [clbk] - callback to invoke after processing data
- * @returns {void}
- */
- function flush( clbk ) {
- try {
- log( line );
- } catch ( err ) {
- stream.emit( 'error', err );
- }
- line = '';
- if ( clbk ) {
- return clbk();
- }
- }
-}
-
-
-// EXPORTS //
-
-module.exports = createStream;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Writes a string to the console.
-*
-* @private
-* @param {string} str - string to write
-*/
-function log( str ) {
- console.log( str ); // eslint-disable-line no-console
-}
-
-
-// EXPORTS //
-
-module.exports = log;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -3x -3x -3x -3x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Removes any pending benchmarks.
-*
-* @private
-*/
-function clear() {
- /* eslint-disable no-invalid-this */
- this._benchmarks.length = 0;
-}
-
-
-// EXPORTS //
-
-module.exports = clear;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -14x -14x -14x -14x -6x -6x -8x -14x -2x -2x -14x -6x -6x -6x -6x -6x -2x -2x -6x -2x -2x -6x -2x -2x -6x -4x -4x -6x -8x -8x -8x -8x -8x -8x -8x -8x -8x -8x -8x -14x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Closes a benchmark runner.
-*
-* @private
-* @returns {void}
-*/
-function closeRunner() {
- /* eslint-disable no-invalid-this */
- var self = this;
- if ( this._closed ) {
- return;
- }
- this._closed = true;
- if ( this._benchmarks.length ) {
- this.clear();
- this._stream.write( '# WARNING: harness closed before completion.\n' );
- } else {
- this._stream.write( '#\n' );
- this._stream.write( '1..'+this.total+'\n' );
- this._stream.write( '# total '+this.total+'\n' );
- this._stream.write( '# pass '+this.pass+'\n' );
- if ( this.fail ) {
- this._stream.write( '# fail '+this.fail+'\n' );
- }
- if ( this.skip ) {
- this._stream.write( '# skip '+this.skip+'\n' );
- }
- if ( this.todo ) {
- this._stream.write( '# todo '+this.todo+'\n' );
- }
- if ( !this.fail ) {
- this._stream.write( '#\n# ok\n' );
- }
- }
- this._stream.once( 'close', onClose );
- this._stream.destroy();
-
- /**
- * Callback invoked upon a `close` event.
- *
- * @private
- */
- function onClose() {
- self.emit( 'close' );
- }
-}
-
-
-// EXPORTS //
-
-module.exports = closeRunner;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -39x -39x -39x -39x -39x -39x -39x -39x -39x -38x -39x -1x -1x -39x -39x -4x -4x -4x -39x -17x -17x -17x -21x -21x -21x -21x -21x -21x -21x -21x -21x -51x -51x -21x -21x -21x -21x -21x -21x -21x -21x -51x -51x -32x -32x -23x -23x -9x -9x -19x -19x -51x -21x -21x -21x -21x -21x -21x -21x -21x -27x -19x -19x -19x -27x -21x -21x -21x -21x -21x -21x -21x -21x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -10x -2x -2x -2x -2x -2x -10x -4x -4x -4x -4x -4x -4x -10x -10x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -21x -21x -21x -21x -21x -21x -21x -4x -4x -39x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-/* eslint-disable no-underscore-dangle */
-
-'use strict';
-
-// MODULES //
-
-var TransformStream = require( '@stdlib/streams/node/transform' ); // eslint-disable-line stdlib/no-redeclare
-var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
-var nextTick = require( './../utils/next_tick.js' );
-
-
-// VARIABLES //
-
-var TAP_HEADER = 'TAP version 13';
-
-
-// MAIN //
-
-/**
-* Creates a results stream.
-*
-* @private
-* @param {Options} [options] - stream options
-* @throws {TypeError} options argument must be an object
-* @throws {TypeError} must provide valid options
-* @returns {TransformStream} transform stream
-*/
-function createStream( options ) {
- /* eslint-disable no-invalid-this */
- var stream;
- var opts;
- var self;
- var id;
-
- self = this;
- if ( arguments.length ) {
- opts = options;
- } else {
- opts = {};
- }
- stream = new TransformStream( opts );
- if ( opts.objectMode ) {
- id = 0;
- this.on( '_push', onPush );
- this.on( 'done', onDone );
- } else {
- stream.write( TAP_HEADER+'\n' );
- this._stream.pipe( stream );
- }
- this.on( '_run', onRun );
- return stream;
-
- /**
- * Runs the next benchmark.
- *
- * @private
- */
- function next() {
- nextTick( onTick );
- }
-
- /**
- * Callback invoked upon the next tick.
- *
- * @private
- * @returns {void}
- */
- function onTick() {
- var b = self._benchmarks.shift();
- if ( b ) {
- b.run();
- if ( !b.ended() ) {
- return b.once( 'end', next );
- }
- return next();
- }
- self._running = false;
- self.emit( 'done' );
- }
-
- /**
- * Callback invoked upon a run event.
- *
- * @private
- * @returns {void}
- */
- function onRun() {
- if ( !self._running ) {
- self._running = true;
- return next();
- }
- }
-
- /**
- * Callback invoked upon a push event.
- *
- * @private
- * @param {Benchmark} b - benchmark
- */
- function onPush( b ) {
- var bid = id;
- id += 1;
-
- b.once( 'prerun', onPreRun );
- b.on( 'result', onResult );
- b.on( 'end', onEnd );
-
- /**
- * Callback invoked upon a `prerun` event.
- *
- * @private
- */
- function onPreRun() {
- var row = {
- 'type': 'benchmark',
- 'name': b.name,
- 'id': bid
- };
- stream.write( row );
- }
-
- /**
- * Callback invoked upon a `result` event.
- *
- * @private
- * @param {(Object|string)} res - result
- */
- function onResult( res ) {
- if ( isString( res ) ) {
- res = {
- 'benchmark': bid,
- 'type': 'comment',
- 'name': res
- };
- } else if ( res.operator === 'result' ) {
- res.benchmark = bid;
- res.type = 'result';
- } else {
- res.benchmark = bid;
- res.type = 'assert';
- }
- stream.write( res );
- }
-
- /**
- * Callback invoked upon an `end` event.
- *
- * @private
- */
- function onEnd() {
- stream.write({
- 'benchmark': bid,
- 'type': 'end'
- });
- }
- }
-
- /**
- * Callback invoked upon a `done` event.
- *
- * @private
- */
- function onDone() {
- stream.destroy();
- }
-}
-
-
-// EXPORTS //
-
-module.exports = createStream;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -168x -168x -168x -168x -168x -168x -168x -168x -168x -168x -168x -168x -168x -168x -64x -64x -168x -168x -168x -168x -168x -168x -168x -168x -168x -31x -168x -32x -32x -168x -168x -104x -104x -64x -64x -64x -64x -64x -168x -48x -168x -16x -16x -16x -16x - - -16x -168x - - -168x - - -64x -64x -64x -168x - -168x -64x -64x -64x -64x -64x -64x -392x -392x -64x -64x -64x -168x -1x -1x -1x -1x -1x - | /* eslint-disable stdlib/jsdoc-require-throws-tags */
-
-/**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var replace = require( '@stdlib/string/base/replace' );
-var hasOwnProp = require( '@stdlib/assert/has-own-property' );
-var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP;
-
-
-// VARIABLES //
-
-var RE_WHITESPACE = /\s+/g;
-
-
-// MAIN //
-
-/**
-* Encodes an assertion.
-*
-* @private
-* @param {Object} result - result
-* @param {PositiveInteger} count - result count
-* @returns {string} encoded assertion
-*/
-function encodeAssertion( result, count ) {
- var actualStack;
- var errorStack;
- var expected;
- var actual;
- var indent;
- var stack;
- var lines;
- var out;
- var i;
-
- out = '';
-
- if ( !result.ok ) {
- out += 'not ';
- }
- // Add result count:
- out += 'ok ' + count;
-
- // Add description:
- if ( result.name ) {
- out += ' ' + replace( result.name.toString(), RE_WHITESPACE, ' ' );
- }
- // Append directives:
- if ( result.skip ) {
- out += ' # SKIP';
- } else if ( result.todo ) {
- out += ' # TODO';
- }
- out += '\n';
- if ( result.ok ) {
- return out;
- }
- // Format diagnostics as YAML...
- indent = ' ';
- out += indent + '---\n';
- out += indent + 'operator: ' + result.operator + '\n';
- if (
- hasOwnProp( result, 'actual' ) ||
- hasOwnProp( result, 'expected' )
- ) {
- // TODO: inspect object logic (https://github.com/substack/tape/blob/master/lib/results.js#L145)
- expected = result.expected;
- actual = result.actual;
- if ( actual !== actual && expected !== expected ) {
- throw new Error( 'unexpected error.' ); // TODO: remove me
- }
- }
- if ( result.at ) {
- out += indent + 'at: ' + result.at + '\n';
- }
- if ( result.actual ) {
- actualStack = result.actual.stack;
- }
- if ( result.error ) {
- errorStack = result.error.stack;
- }
- if ( actualStack ) {
- stack = actualStack;
- } else {
- stack = errorStack;
- }
- if ( stack ) {
- lines = stack.toString().split( RE_EOL );
- out += indent + 'stack: |-\n';
- for ( i = 0; i < lines.length; i++ ) {
- out += indent + ' ' + lines[ i ] + '\n';
- }
- }
- out += indent + '...\n';
- return out;
-}
-
-
-// EXPORTS //
-
-module.exports = encodeAssertion;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -32x -32x -32x -32x -32x -32x -32x -32x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// VARIABLES //
-
-var YAML_INDENT = ' ';
-var YAML_BEGIN = YAML_INDENT + '---\n';
-var YAML_END = YAML_INDENT + '...\n';
-
-
-// MAIN //
-
-/**
-* Encodes a result as a YAML block.
-*
-* @private
-* @param {Object} result - result
-* @returns {string} encoded result
-*/
-function encodeResult( result ) {
- var out = YAML_BEGIN;
- out += YAML_INDENT + 'iterations: '+result.iterations+'\n';
- out += YAML_INDENT + 'elapsed: '+result.elapsed+'\n';
- out += YAML_INDENT + 'rate: '+result.rate+'\n';
- out += YAML_END;
- return out;
-}
-
-
-// EXPORTS //
-
-module.exports = encodeResult;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -2x -2x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Forcefully exits a benchmark runner.
-*
-* @private
-*/
-function exit() {
- /* eslint-disable no-invalid-this */
- var self;
- var i;
- for ( i = 0; i < this._benchmarks.length; i++ ) {
- this._benchmarks[ i ].exit();
- }
- self = this;
- this.clear();
- this._stream.once( 'close', onClose );
- this._stream.destroy();
-
- /**
- * Callback invoked upon a `close` event.
- *
- * @private
- */
- function onClose() {
- self.emit( 'close' );
- }
-}
-
-
-// EXPORTS //
-
-module.exports = exit;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
|---|---|---|---|---|---|---|---|---|---|
| clear.js | -
-
- |
- 100% | -36/36 | -100% | -2/2 | -100% | -1/1 | -100% | -36/36 | -
| close.js | -
-
- |
- 100% | -73/73 | -100% | -12/12 | -100% | -2/2 | -100% | -73/73 | -
| create_stream.js | -
-
- |
- 100% | -189/189 | -100% | -23/23 | -100% | -9/9 | -100% | -189/189 | -
| encode_assertion.js | -
-
- |
- 94.21% | -114/121 | -75% | -15/20 | -100% | -1/1 | -94.21% | -114/121 | -
| encode_result.js | -
-
- |
- 100% | -49/49 | -100% | -2/2 | -100% | -1/1 | -100% | -49/49 | -
| exit.js | -
-
- |
- 100% | -53/53 | -100% | -4/4 | -100% | -2/2 | -100% | -53/53 | -
| index.js | -
-
- |
- 100% | -216/216 | -100% | -4/4 | -100% | -1/1 | -100% | -216/216 | -
| push.js | -
-
- |
- 100% | -100/100 | -100% | -16/16 | -100% | -3/3 | -100% | -100/100 | -
| run.js | -
-
- |
- 100% | -36/36 | -100% | -2/2 | -100% | -1/1 | -100% | -36/36 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -37x -37x -1x -1x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -36x -37x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var EventEmitter = require( 'events' ).EventEmitter;
-var inherit = require( '@stdlib/utils/inherit' );
-var defineProperty = require( '@stdlib/utils/define-property' );
-var TransformStream = require( '@stdlib/streams/node/transform' );
-var push = require( './push.js' );
-var createStream = require( './create_stream.js' );
-var run = require( './run.js' );
-var clear = require( './clear.js' );
-var close = require( './close.js' ); // eslint-disable-line stdlib/no-redeclare
-var exit = require( './exit.js' );
-
-
-// MAIN //
-
-/**
-* Benchmark runner.
-*
-* @private
-* @constructor
-* @returns {Runner} Runner instance
-*
-* @example
-* var runner = new Runner();
-*/
-function Runner() {
- if ( !( this instanceof Runner ) ) {
- return new Runner();
- }
- EventEmitter.call( this );
-
- // Private properties:
- defineProperty( this, '_benchmarks', {
- 'value': [],
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
- });
-
- defineProperty( this, '_stream', {
- 'value': new TransformStream(),
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
- });
-
- defineProperty( this, '_closed', {
- 'value': false,
- 'configurable': false,
- 'writable': true,
- 'enumerable': false
- });
-
- defineProperty( this, '_running', {
- 'value': false,
- 'configurable': false,
- 'writable': true,
- 'enumerable': false
- });
-
- // Public properties:
- defineProperty( this, 'total', {
- 'value': 0,
- 'configurable': false,
- 'writable': true,
- 'enumerable': true
- });
-
- defineProperty( this, 'fail', {
- 'value': 0,
- 'configurable': false,
- 'writable': true,
- 'enumerable': true
- });
-
- defineProperty( this, 'pass', {
- 'value': 0,
- 'configurable': false,
- 'writable': true,
- 'enumerable': true
- });
-
- defineProperty( this, 'skip', {
- 'value': 0,
- 'configurable': false,
- 'writable': true,
- 'enumerable': true
- });
-
- defineProperty( this, 'todo', {
- 'value': 0,
- 'configurable': false,
- 'writable': true,
- 'enumerable': true
- });
-
- return this;
-}
-
-/*
-* Inherit from the `EventEmitter` prototype.
-*/
-inherit( Runner, EventEmitter );
-
-/**
-* Adds a new benchmark.
-*
-* @private
-* @memberof Runner.prototype
-* @function push
-* @param {Benchmark} b - benchmark
-*/
-defineProperty( Runner.prototype, 'push', {
- 'value': push,
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
-});
-
-/**
-* Creates a results stream.
-*
-* @private
-* @memberof Runner.prototype
-* @function createStream
-* @param {Options} [options] - stream options
-* @returns {TransformStream} transform stream
-*/
-defineProperty( Runner.prototype, 'createStream', {
- 'value': createStream,
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
-});
-
-/**
-* Runs pending benchmarks.
-*
-* @private
-* @memberof Runner.prototype
-* @function run
-*/
-defineProperty( Runner.prototype, 'run', {
- 'value': run,
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
-});
-
-/**
-* Removes any pending benchmarks.
-*
-* @private
-* @memberof Runner.prototype
-* @function clear
-*/
-defineProperty( Runner.prototype, 'clear', {
- 'value': clear,
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
-});
-
-/**
-* Closes a benchmark runner.
-*
-* @private
-* @memberof Runner.prototype
-* @function close
-*/
-defineProperty( Runner.prototype, 'close', {
- 'value': close,
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
-});
-
-/**
-* Forcefully exits a benchmark runner.
-*
-* @private
-* @memberof Runner.prototype
-* @function exit
-*/
-defineProperty( Runner.prototype, 'exit', {
- 'value': exit,
- 'configurable': false,
- 'writable': false,
- 'enumerable': false
-});
-
-
-// EXPORTS //
-
-module.exports = Runner;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -38x -32x -32x -38x -38x -38x -38x -38x -38x -38x -38x -38x -203x -203x -3x -3x -203x -32x -32x -32x -168x -203x -104x -31x -104x -1x -1x -104x -104x -64x -64x -31x -31x -31x -33x -33x -33x -33x -168x -168x -203x -38x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-/* eslint-disable no-underscore-dangle */
-
-'use strict';
-
-// MODULES //
-
-var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
-var encodeAssertion = require( './encode_assertion.js' );
-var encodeResult = require( './encode_result.js' );
-
-
-// MAIN //
-
-/**
-* Adds a new benchmark.
-*
-* @private
-* @param {Benchmark} b - benchmark
-*/
-function push( b ) {
- /* eslint-disable no-invalid-this */
- var self = this;
-
- this._benchmarks.push( b );
-
- b.once( 'prerun', onPreRun );
- b.on( 'result', onResult );
-
- this.emit( '_push', b );
-
- /**
- * Callback invoked upon a `prerun` event.
- *
- * @private
- */
- function onPreRun() {
- self._stream.write( '# '+b.name+'\n' );
- }
-
- /**
- * Callback invoked upon a `result` event.
- *
- * @private
- * @param {(Object|string)} res - result
- * @returns {void}
- */
- function onResult( res ) {
- // Check for a comment...
- if ( isString( res ) ) {
- return self._stream.write( '# '+res+'\n' );
- }
- if ( res.operator === 'result' ) {
- res = encodeResult( res );
- return self._stream.write( res );
- }
- self.total += 1;
- if ( res.ok ) {
- if ( res.skip ) {
- self.skip += 1;
- } else if ( res.todo ) {
- self.todo += 1;
- }
- self.pass += 1;
- }
- // According to the TAP spec, todos pass even if not "ok"...
- else if ( res.todo ) {
- self.pass += 1;
- self.todo += 1;
- }
- // Everything else is a failure...
- else {
- self.fail += 1;
- }
- res = encodeAssertion( res, self.total );
- self._stream.write( res );
- }
-}
-
-
-// EXPORTS //
-
-module.exports = push;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -27x -27x -27x -27x -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Runs pending benchmarks.
-*
-* @private
-*/
-function run() {
- /* eslint-disable no-invalid-this */
- this.emit( '_run' );
-}
-
-
-// EXPORTS //
-
-module.exports = run;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 | 4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x -4x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var canExit = require( './can_exit.js' ); - - -// MAIN // - -var bool = ( !IS_BROWSER && canExit ); - - -// EXPORTS // - -module.exports = bool; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var proc = require( './process.js' ); - - -// MAIN // - -var bool = ( proc && typeof proc.exit === 'function' ); - - -// EXPORTS // - -module.exports = bool; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
|---|---|---|---|---|---|---|---|---|---|
| can_emit_exit.js | -
-
- |
- 100% | -34/34 | -100% | -2/2 | -100% | -0/0 | -100% | -34/34 | -
| can_exit.js | -
-
- |
- 100% | -33/33 | -100% | -1/1 | -100% | -0/0 | -100% | -33/33 | -
| next_tick.js | -
-
- |
- 100% | -44/44 | -100% | -2/2 | -100% | -1/1 | -100% | -44/44 | -
| process.js | -
-
- |
- 100% | -28/28 | -100% | -1/1 | -100% | -0/0 | -100% | -28/28 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 | 2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -2x -92x -92x -92x -2x -2x -2x -2x -2x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Runs a function on a subsequent turn of the event loop.
-*
-* ## Notes
-*
-* - `process.nextTick` is only Node.js.
-* - `setImmediate` is non-standard.
-* - Everything else is browser based (e.g., mutation observer, requestAnimationFrame, etc).
-* - Only API which is universal is `setTimeout`.
-* - Note that `0` is not actually `0ms`. Browser environments commonly have a minimum delay of `4ms`. This is acceptable. Here, the main intent of this function is to give the runtime a chance to run garbage collection, clear state, and tend to any other pending tasks before returning control to benchmark tasks. The larger aim (attainable or not) is to provide each benchmark run with as much of a fresh state as possible.
-*
-* @private
-* @param {Function} fcn - function to run upon a subsequent turn of the event loop
-*/
-function nextTick( fcn ) {
- setTimeout( fcn, 0 );
-}
-
-
-// EXPORTS //
-
-module.exports = nextTick;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var proc = require( 'process' ); - - -// EXPORTS // - -module.exports = proc; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Test whether an input value is the string representing column-major order. -* -* @module @stdlib/ndarray/base/assert/is-column-major-string -* -* @example -* var isColumnMajorString = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); -* -* var bool = isColumnMajorString( 'column-major' ); -* // returns true -* -* bool = isColumnMajorString( 'row-major' ); -* // returns false -* -* bool = isColumnMajorString( 'foo' ); -* // returns false -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2025 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Tests whether an input value is the string representing column-major order.
-*
-* @param {*} v - value to test
-* @returns {boolean} boolean result
-*
-* @example
-* var bool = isColumnMajorString( 'column-major' );
-* // returns true
-*
-* bool = isColumnMajorString( 'row-major' );
-* // returns false
-*
-* bool = isColumnMajorString( 'foo' );
-* // returns false
-*/
-function isColumnMajorString( v ) {
- return ( v === 'column-major' );
-}
-
-
-// EXPORTS //
-
-module.exports = isColumnMajorString;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert an ndarray-like object to a scalar value. -* -* @module @stdlib/ndarray/base/ndarraylike2scalar -* -* @example -* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' ); -* var ndarraylike2scalar = require( '@stdlib/ndarray/base/ndarraylike2scalar' ); -* -* var x = scalar2ndarray( 1.0 ); -* // returns <ndarray> -* -* var out = ndarraylike2scalar( x ); -* // returns 1.0 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2025 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var resolveGetter = require( '@stdlib/array/base/resolve-getter' );
-var getOffset = require( '@stdlib/ndarray/base/offset' );
-var getData = require( '@stdlib/ndarray/base/data-buffer' );
-
-
-// MAIN //
-
-/**
-* Converts an ndarray-like object to a scalar value.
-*
-* @param {ndarrayLike} x - ndarray-like object
-* @param {*} x.dtype - data type
-* @param {Collection} x.data - data buffer
-* @param {NonNegativeIntegerArray} x.shape - dimensions
-* @param {IntegerArray} x.strides - stride lengths
-* @param {NonNegativeInteger} x.offset - index offset
-* @param {string} x.order - specifies whether `x` is row-major (C-style) or column-major (Fortran-style)
-* @returns {*} scalar value
-*
-* @example
-* var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
-*
-* var x = scalar2ndarray( 1.0 );
-* // returns <ndarray>
-*
-* var out = ndarraylike2scalar( x );
-* // returns 1.0
-*/
-function ndarraylike2scalar( x ) {
- var buf = getData( x );
- var get = resolveGetter( buf );
- return get( buf, getOffset( x ) );
-}
-
-
-// EXPORTS //
-
-module.exports = ndarraylike2scalar;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Normalize an index to the interval `[0,max]`. -* -* @module @stdlib/ndarray/base/normalize-index -* -* @example -* var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' ); -* -* var idx = normalizeIndex( -2, 10 ); -* // returns 9 -* -* idx = normalizeIndex( 15, 10 ); -* // returns -1 -* -* idx = normalizeIndex( 5, 10 ); -* // returns 5 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - - - - - - - - -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2023 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Normalizes an index to the interval `[0,max]`.
-*
-* @param {integer} idx - index
-* @param {NonNegativeInteger} max - maximum index
-* @returns {integer} index
-*
-* @example
-* var idx = normalizeIndex( -2, 10 );
-* // returns 9
-*
-* idx = normalizeIndex( 15, 10 );
-* // returns -1
-*
-* idx = normalizeIndex( 5, 10 );
-* // returns 5
-*/
-function normalizeIndex( idx, max ) {
- if ( idx < 0 ) {
- idx += max + 1;
- if ( idx < 0 ) {
- return -1;
- }
- return idx;
- }
- if ( idx > max ) {
- return -1;
- }
- return idx;
-}
-
-
-// EXPORTS //
-
-module.exports = normalizeIndex;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - - - - - - - - -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - - - - - - -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
-
-
-// FUNCTIONS //
-
-/**
-* Generates a stride array from an array shape (row-major).
-*
-* @private
-* @param {NonNegativeIntegerArray} shape - array shape
-* @param {(Array|TypedArray|Object)} out - output object
-* @returns {(Array|TypedArray|Object)} array strides
-*/
-function rowmajor( shape, out ) {
- var ndims;
- var s;
- var i;
-
- ndims = shape.length;
- s = 1;
- for ( i = ndims-1; i >= 0; i-- ) {
- out[ i ] = s;
- s *= shape[ i ];
- }
- return out;
-}
-
-/**
-* Generates a stride array from an array shape (column-major).
-*
-* @private
-* @param {NonNegativeIntegerArray} shape - array shape
-* @param {(Array|TypedArray|Object)} out - output object
-* @returns {(Array|TypedArray|Object)} array strides
-*/
-function columnmajor( shape, out ) {
- var s;
- var i;
-
- s = 1;
- for ( i = 0; i < shape.length; i++ ) {
- out[ i ] = s;
- s *= shape[ i ];
- }
- return out;
-}
-
-
-// MAIN //
-
-/**
-* Generates a stride array from an array shape.
-*
-* @param {NonNegativeIntegerArray} shape - array shape
-* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
-* @param {(Array|TypedArray|Object)} out - output object
-* @returns {(Array|TypedArray|Object)} array strides
-*
-* @example
-* var strides = [ 0, 0 ];
-*
-* var out = shape2strides( [ 3, 2 ], 'row-major', strides );
-* // returns [ 2, 1 ]
-*
-* var bool = ( out === strides );
-* // returns true
-*
-* out = shape2strides( [ 3, 2 ], 'column-major', strides );
-* // returns [ 1, 3 ]
-*/
-function shape2strides( shape, order, out ) {
- if ( isColumnMajor( order ) ) {
- return columnmajor( shape, out );
- }
- return rowmajor( shape, out );
-}
-
-
-// EXPORTS //
-
-module.exports = shape2strides;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| File | -- | Statements | -- | Branches | -- | Functions | -- | Lines | -- |
|---|---|---|---|---|---|---|---|---|---|
| assign.js | -
-
- |
- 70.87% | -73/103 | -100% | -1/1 | -0% | -0/3 | -70.87% | -73/103 | -
| index.js | -
-
- |
- 100% | -50/50 | -100% | -1/1 | -100% | -0/0 | -100% | -50/50 | -
| main.js | -
-
- |
- 63.72% | -65/102 | -100% | -1/1 | -0% | -0/3 | -63.72% | -65/102 | -
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate a stride array from an array shape. -* -* @module @stdlib/ndarray/base/shape2strides -* -* @example -* var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); -* -* var strides = shape2strides( [ 3, 2 ], 'row-major' ); -* // returns [ 2, 1 ] -* -* strides = shape2strides( [ 3, 2 ], 'column-major' ); -* // returns [ 1, 3 ] -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var main = require( './main.js' ); -var assign = require( './assign.js' ); - - -// MAIN // - -setReadOnly( main, 'assign', assign ); - - -// EXPORTS // - -module.exports = main; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - - - - - - - - - - - - - -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - - - - - - - - -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MODULES //
-
-var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
-
-
-// FUNCTIONS //
-
-/**
-* Generates a stride array from an array shape (row-major).
-*
-* @private
-* @param {NonNegativeIntegerArray} shape - array shape
-* @returns {Array} array strides
-*/
-function rowmajor( shape ) {
- var ndims;
- var out;
- var s;
- var i;
-
- ndims = shape.length;
- out = [];
- for ( i = 0; i < ndims; i++ ) {
- out.push( 0 );
- }
- s = 1;
- for ( i = ndims-1; i >= 0; i-- ) {
- out[ i ] = s;
- s *= shape[ i ];
- }
- return out;
-}
-
-/**
-* Generates a stride array from an array shape (column-major).
-*
-* @private
-* @param {NonNegativeIntegerArray} shape - array shape
-* @returns {Array} array strides
-*/
-function columnmajor( shape ) {
- var out;
- var s;
- var i;
-
- out = [];
- s = 1;
- for ( i = 0; i < shape.length; i++ ) {
- out.push( s );
- s *= shape[ i ];
- }
- return out;
-}
-
-
-// MAIN //
-
-/**
-* Generates a stride array from an array shape.
-*
-* @param {NonNegativeIntegerArray} shape - array shape
-* @param {string} order - specifies whether an array is row-major (C-style) or column-major (Fortran-style)
-* @returns {Array} array strides
-*
-* @example
-* var s = shape2strides( [ 3, 2 ], 'row-major' );
-* // returns [ 2, 1 ]
-*
-* s = shape2strides( [ 3, 2 ], 'column-major' );
-* // returns [ 1, 3 ]
-*/
-function shape2strides( shape, order ) {
- if ( isColumnMajor( order ) ) {
- return columnmajor( shape );
- }
- return rowmajor( shape );
-}
-
-
-// EXPORTS //
-
-module.exports = shape2strides;
- |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - | /** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Determine the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array. -* -* @module @stdlib/ndarray/base/strides2offset -* -* @example -* var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); -* -* var shape = [ 2, 3, 10 ]; -* var strides = [ 30, -10, 1 ]; -* -* var offset = strides2offset( shape, strides ); -* // returns 20 -*/ - -// MODULES // - -var strides2offset = require( './main.js' ); - - -// EXPORTS // - -module.exports = strides2offset; - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
- -| 1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 | 1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x -1x - - - - - - - - - - - - - - - -1x -1x -1x -1x -1x - | /**
-* @license Apache-2.0
-*
-* Copyright (c) 2018 The Stdlib Authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-'use strict';
-
-// MAIN //
-
-/**
-* Returns the index offset which specifies the location of the first indexed value in a multidimensional array based on a stride array.
-*
-* @param {NonNegativeIntegerArray} shape - array shape
-* @param {IntegerArray} strides - stride array
-* @returns {NonNegativeInteger} offset - offset
-*
-* @example
-* var shape = [ 2, 3, 10 ];
-* var strides = [ 30, -10, 1 ];
-*
-* var offset = strides2offset( shape, strides );
-* // returns 20
-*/
-function strides2offset( shape, strides ) {
- var offset;
- var ndims;
- var i;
-
- ndims = shape.length;
- offset = 0;
- for ( i = 0; i < ndims; i++ ) {
- if ( strides[ i ] < 0 ) {
- // Note that, since the stride is negative, this operation increments, not decrements, the offset...
- offset -= strides[ i ] * ( shape[ i ]-1 );
- }
- }
- return offset;
-}
-
-
-// EXPORTS //
-
-module.exports = strides2offset;
- |