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 Jul 14, 2024
1 parent 12d4976 commit 1132148
Show file tree
Hide file tree
Showing 14 changed files with 7,383 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<section class="release" id="unreleased">

## Unreleased (2024-07-13)
## Unreleased (2024-07-14)

<section class="packages">

Expand Down Expand Up @@ -711,10 +711,11 @@

### Contributors

A total of 3 people contributed to this release. Thank you to the following contributors:
A total of 4 people contributed to this release. Thank you to the following contributors:

- Athan Reines
- Jaysukh Makvana
- Muhammad Haris
- Philipp Burckhardt

</section>
Expand All @@ -727,6 +728,7 @@ A total of 3 people contributed to this release. Thank you to the following cont

<details>

- [`903c51c`](https://github.com/stdlib-js/stdlib/commit/903c51c7d0a06d9186a6f2be1b01fa25f770a3eb) - **test:** add tests to `@stdlib/ndarray/base/nullary` [(#2350)](https://github.com/stdlib-js/stdlib/pull/2350) _(by Muhammad Haris, Athan Reines)_
- [`de17de3`](https://github.com/stdlib-js/stdlib/commit/de17de32867461079aae166d5cecbecb1da7f922) - **feat:** update namespace TypeScript declarations [(#2593)](https://github.com/stdlib-js/stdlib/pull/2593) _(by stdlib-bot, Athan Reines)_
- [`71cf5a0`](https://github.com/stdlib-js/stdlib/commit/71cf5a05a13d12aed627d332147642adc4694ab9) - **feat:** add boolean dtype support to `ndarray/empty*` and `ndarray/base/empty*` packages [(#2588)](https://github.com/stdlib-js/stdlib/pull/2588) _(by Jaysukh Makvana, Athan Reines)_
- [`f766a56`](https://github.com/stdlib-js/stdlib/commit/f766a563e112098dc229991c0eedb5f5b7417811) - **feat:** add boolean dtype support to `ndarray/from-scalar` [(#2589)](https://github.com/stdlib-js/stdlib/pull/2589) _(by Jaysukh Makvana, Athan Reines)_
Expand Down
72 changes: 72 additions & 0 deletions base/nullary/test/test.0d.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 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 tape = require( 'tape' );
var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' );
var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' );
var Complex128Array = require( '@stdlib/array/complex128' );
var Float64Array = require( '@stdlib/array/float64' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var constantFunction = require( '@stdlib/utils/constant-function' );
var scalar2ndarray = require( './../../../from-scalar' );
var nullary = require( './../lib' );


// TESTS //

tape( 'main export is a function', function test( t ) {
t.ok( true, __filename );
t.strictEqual( typeof nullary, 'function', 'main export is a function');
t.end();
});

tape( 'the function applies a nullary callback to each indexed element of a 0-dimensional ndarray', function test( t ) {
var expected;
var x;

x = scalar2ndarray( 0.0, {
'dtype': 'float64'
});

nullary( [ x ], constantFunction( 10.0 ) );

expected = new Float64Array( [ 10.0 ] );
t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' );

t.end();
});

tape( 'the function applies a nullary callback to each indexed element of a 0-dimensional ndarray (accessors)', function test( t ) {
var expected;
var x;

x = scalar2ndarray( new Complex128( 0.0, 0.0 ), {
'dtype': 'complex128'
});

nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) );

expected = new Complex128Array( [ 10.0, 10.0 ] );
t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' );

t.end();
});
Loading

0 comments on commit 1132148

Please sign in to comment.