Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Oct 13, 2023
1 parent 7fee715 commit ea70574
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 101 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@stdlib/buffer-alloc-unsafe": "^0.1.0",
"@stdlib/constants-float64-pinf": "^0.1.1",
"@stdlib/math-base-assert-is-integer": "^0.1.1",
"@stdlib/math-base-special-abs": "^0.1.0",
"@stdlib/math-base-special-abs": "^0.1.1",
"@stdlib/ndarray-base-assert-is-allowed-data-type-cast": "^0.1.0",
"@stdlib/ndarray-base-assert-is-casting-mode": "^0.1.1",
"@stdlib/ndarray-base-assert-is-data-type": "^0.1.0",
Expand All @@ -59,7 +59,7 @@
"@stdlib/ndarray-base-numel": "^0.1.1",
"@stdlib/ndarray-base-shape2strides": "^0.1.1",
"@stdlib/ndarray-base-strides2offset": "^0.1.1",
"@stdlib/ndarray-base-strides2order": "^0.1.0",
"@stdlib/ndarray-base-strides2order": "^0.1.1",
"@stdlib/ndarray-ctor": "^0.1.0",
"@stdlib/ndarray-data-buffer": "github:stdlib-js/ndarray-data-buffer#main",
"@stdlib/ndarray-defaults": "^0.1.1",
Expand Down Expand Up @@ -106,7 +106,8 @@
"multidimensional",
"dimensions",
"dims",
"numpy.array"
"numpy.array",
"numpy.asarray"
],
"__stdlib__": {},
"funding": {
Expand Down
101 changes: 4 additions & 97 deletions test/dist/test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
* 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.
Expand All @@ -21,106 +21,13 @@
// MODULES //

var tape = require( 'tape' );
var ndarray = require( './../../dist' );
var main = require( './../../dist' );


// TESTS //

tape( 'main export is a function', function test( t ) {
tape( 'main export is defined', function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof ndarray, 'function', 'main export is a function' );
t.strictEqual( main !== void 0, true, 'main export is defined' );
t.end();
});

tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) {
var values;
var i;

values = [
'5',
5,
NaN,
true,
false,
null,
void 0,
function noop() {}
];

for ( i = 0; i < values.length; i++ ) {
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[ i ] );
}
t.end();

function badValue( value ) {
return function badValue() {
ndarray( value );
};
}
});

tape( 'the function throws an error if not provided either a `shape` or `buffer` option', function test( t ) {
t.throws( badValue( {} ), Error, 'throws an error when not provided either a `shape` or `buffer` option' );
t.end();

function badValue( value ) {
return function badValue() {
ndarray( value );
};
}
});

tape( 'the function throws an error if provided an invalid option', function test( t ) {
var values;
var i;

values = [
'5',
'beep',
'boop',
'foo',
'bar',
5,
NaN,
true,
false,
null,
void 0,
[],
{},
function noop() {}
];

for ( i = 0; i < values.length; i++ ) {
t.throws( badValue( values[i] ), TypeError, 'throws an error when provided '+values[ i ] );
}
t.end();

function badValue( value ) {
return function badValue() {
var opts = {
'shape': [ 3, 2 ],
'dtype': value
};
ndarray( opts );
};
}
});

tape( 'the function throws an error if provided a `shape` option which is incompatible with a provided buffer', function test( t ) {
var opts = {
'dtype': 'generic',
'shape': [ 3, 3 ],
'buffer': [ 1, 2, 3, 4, 5, 6 ]
};
t.throws( badValue( opts ), Error, 'throws an error when provided incompatible `shape` and `buffer` options' );
t.end();

function badValue( value ) {
return function badValue() {
ndarray( value );
};
}
});

// TODO: tests

0 comments on commit ea70574

Please sign in to comment.