Skip to content

Commit 1132148

Browse files
committed
Auto-generated commit
1 parent 12d4976 commit 1132148

File tree

14 files changed

+7383
-4
lines changed

14 files changed

+7383
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-07-13)
7+
## Unreleased (2024-07-14)
88

99
<section class="packages">
1010

@@ -711,10 +711,11 @@
711711

712712
### Contributors
713713

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

716716
- Athan Reines
717717
- Jaysukh Makvana
718+
- Muhammad Haris
718719
- Philipp Burckhardt
719720

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

728729
<details>
729730

731+
- [`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)_
730732
- [`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)_
731733
- [`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)_
732734
- [`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)_

base/nullary/test/test.0d.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var tape = require( 'tape' );
24+
var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' );
25+
var isSameFloat64Array = require( '@stdlib/assert/is-same-float64array' );
26+
var Complex128Array = require( '@stdlib/array/complex128' );
27+
var Float64Array = require( '@stdlib/array/float64' );
28+
var Complex128 = require( '@stdlib/complex/float64/ctor' );
29+
var constantFunction = require( '@stdlib/utils/constant-function' );
30+
var scalar2ndarray = require( './../../../from-scalar' );
31+
var nullary = require( './../lib' );
32+
33+
34+
// TESTS //
35+
36+
tape( 'main export is a function', function test( t ) {
37+
t.ok( true, __filename );
38+
t.strictEqual( typeof nullary, 'function', 'main export is a function');
39+
t.end();
40+
});
41+
42+
tape( 'the function applies a nullary callback to each indexed element of a 0-dimensional ndarray', function test( t ) {
43+
var expected;
44+
var x;
45+
46+
x = scalar2ndarray( 0.0, {
47+
'dtype': 'float64'
48+
});
49+
50+
nullary( [ x ], constantFunction( 10.0 ) );
51+
52+
expected = new Float64Array( [ 10.0 ] );
53+
t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' );
54+
55+
t.end();
56+
});
57+
58+
tape( 'the function applies a nullary callback to each indexed element of a 0-dimensional ndarray (accessors)', function test( t ) {
59+
var expected;
60+
var x;
61+
62+
x = scalar2ndarray( new Complex128( 0.0, 0.0 ), {
63+
'dtype': 'complex128'
64+
});
65+
66+
nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) );
67+
68+
expected = new Complex128Array( [ 10.0, 10.0 ] );
69+
t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' );
70+
71+
t.end();
72+
});

0 commit comments

Comments
 (0)