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 14, 2023
1 parent d3fe0a3 commit 5811ff0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 70 deletions.
2 changes: 2 additions & 0 deletions data/data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3668,6 +3668,7 @@ ndarray.prototype.toString,"var b = [ 1, 2, 3, 4 ];\nvar d = [ 2, 2 ];\nvar s =
ndarray.prototype.toJSON,"var b = [ 1, 2, 3, 4 ];\nvar d = [ 2, 2 ];\nvar s = [ 2, 1 ];\nvar o = 0;\nvar arr = ndarray( 'generic', b, d, s, o, 'row-major' );\narr.toJSON()\n"
ndarray2array,"var arr = array( [ [ 1, 2 ], [ 3, 4 ] ] );\nvar out = ndarray2array( arr )\n"
ndarrayCastingModes,"var out = ndarrayCastingModes()\n"
ndarrayDataBuffer,"var opts = { 'dtype': 'float64' };\nvar out = ndarrayDataBuffer( ndzeros( [ 3, 3, 3 ], opts ) )\n"
ndarrayDataType,"var opts = { 'dtype': 'float64' };\nvar dt = ndarrayDataType( ndzeros( [ 3, 3, 3 ], opts ) )\n"
ndarrayDataTypes,"var out = ndarrayDataTypes()\nout = ndarrayDataTypes( 'floating_point' )\n"
ndarrayDispatch,"var t = [ 'float64', 'float64', 'float32', 'float32' ];\nvar d = [ base.abs, base.absf ];\nvar f = ndarrayDispatch( base.ndarrayUnary, t, d, 2, 1, 1 );\nvar xbuf = new Float64Array( [ -1.0, -2.0, -3.0, -4.0 ] );\nvar x = ndarray( 'float64', xbuf, [ 4 ], [ 1 ], 0, 'row-major' );\nvar ybuf = new Float64Array( [ 0.0, 0.0, 0.0, 0.0 ] );\nvar y = ndarray( 'float64', ybuf, [ 4 ], [ 1 ], 0, 'row-major' );\nf( x, y );\nybuf\n"
Expand All @@ -3692,6 +3693,7 @@ nditerRows,"var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );\nvar it = nditerRows( x );\
nditerValues,"var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );\nvar it = nditerValues( x );\nvar v = it.next().value\nv = it.next().value\n"
ndslice,"var x = array( [ [ 1, 2 ], [ 3, 4 ] ] )\nx.shape\nvar s = new MultiSlice( null, 1 )\nvar y = ndslice( x, s )\ny.shape\nndarray2array( y )\n"
ndsliceAssign,"var y = ndzeros( [ 2, 2 ] )\nvar x = scalar2ndarray( 3.0 )\nvar s = new MultiSlice( null, 1 )\nvar out = ndsliceAssign( x, y, s )\nvar bool = ( out === y )\nndarray2array( y )\n"
ndsliceDimension,"var x = array( [ [ 1, 2 ], [ 3, 4 ] ] )\nx.shape\nvar y = ndsliceDimension( x, 1, 1 )\ny.shape\nndarray2array( y )\n"
ndzeros,"var arr = ndzeros( [ 2, 2 ] )\nvar sh = arr.shape\nvar dt = arr.dtype\n"
ndzerosLike,"var x = base.ndzeros( 'float64', [ 2, 2 ], 'row-major' )\nvar sh = x.shape\nvar dt = x.dtype\nvar y = ndzerosLike( x )\nsh = y.shape\ndt = y.dtype\n"
nextGraphemeClusterBreak,"var out = nextGraphemeClusterBreak( 'last man standing', 4 )\nout = nextGraphemeClusterBreak( 'presidential election', 8 )\nout = nextGraphemeClusterBreak( 'अनुच्छेद', 1 )\nout = nextGraphemeClusterBreak( '🌷' )\n"
Expand Down
2 changes: 1 addition & 1 deletion data/data.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.js.map

Large diffs are not rendered by default.

70 changes: 4 additions & 66 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) 2019 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,75 +21,13 @@
// MODULES //

var tape = require( 'tape' );
var aliases = require( '@stdlib/namespace-aliases' );
var DATA = require( './../../data/data.json' );
var example = 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 example, 'function', 'main export is a function' );
t.end();
});

tape( 'the function throws an error if not provided a string', function test( t ) {
var values;
var i;

values = [
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() {
example( value );
};
}
});

tape( 'the function returns an example as text', function test( t ) {
var expected;
var actual;
var list;
var i;

list = aliases();
for ( i = 0; i < list.length; i++ ) {
expected = DATA[ list[i] ];
if ( expected === void 0 ) {
expected = null;
}
actual = example( list[i] );
t.strictEqual( actual, expected, 'returns expected value for '+list[i] );
}
t.end();
});

tape( 'the function returns `null` if provided an unrecognized alias', function test( t ) {
var values;
var i;

values = [
'adfkaljdfdsafs',
'adklfadjflajdslfjalsdf',
'adflkajdlkfjasdlkfjsadlkfjlasdjflsdjfla'
];
for ( i = 0; i < values.length; i++ ) {
t.strictEqual( example( values[ i ] ), null, 'returns expected value' );
}
t.strictEqual( main !== void 0, true, 'main export is defined' );
t.end();
});

0 comments on commit 5811ff0

Please sign in to comment.