Skip to content

Commit 755ff05

Browse files
committed
Auto-generated commit
1 parent 67b7302 commit 755ff05

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
<details>
3333

34+
- [`f4a90b1`](https://github.com/stdlib-js/stdlib/commit/f4a90b18816acbb01c3c5afd7fba965c8a617ec1) - **chore:** add test and benchmark stubs _(by Athan Reines)_
3435
- [`24a79a0`](https://github.com/stdlib-js/stdlib/commit/24a79a0b97e2191aa52abe3fe336505472060d35) - **docs:** add note _(by Athan Reines)_
3536
- [`195071c`](https://github.com/stdlib-js/stdlib/commit/195071c47d1088fc1b024023c9b9b693fc6282cb) - **style:** disable lint rule _(by Athan Reines)_
3637
- [`13b4d50`](https://github.com/stdlib-js/stdlib/commit/13b4d50284b4f5ba44c714add98ae8d04606cb86) - **feat:** add initial implementation of `dstructs/struct` _(by Athan Reines)_

struct/benchmark/benchmark.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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 bench = require( '@stdlib/bench' );
24+
var isFunction = require( '@stdlib/assert/is-function' );
25+
var pkg = require( './../package.json' ).name;
26+
var struct = require( './../lib' );
27+
28+
29+
// MAIN //
30+
31+
bench( pkg, function benchmark( b ) {
32+
var values;
33+
var v;
34+
var i;
35+
36+
values = [
37+
[
38+
{
39+
'name': 'foo',
40+
'type': 'float64'
41+
}
42+
],
43+
[
44+
{
45+
'name': 'bar',
46+
'type': 'float32'
47+
}
48+
],
49+
[
50+
{
51+
'name': 'beep',
52+
'type': 'int32'
53+
}
54+
],
55+
[
56+
{
57+
'name': 'boop',
58+
'type': 'uint32'
59+
}
60+
]
61+
];
62+
63+
b.tic();
64+
for ( i = 0; i < b.iterations; i++ ) {
65+
v = struct( values[ i%values.length ] );
66+
if ( typeof v !== 'function' ) {
67+
b.fail( 'should return a function' );
68+
}
69+
}
70+
b.toc();
71+
if ( !isFunction( v ) ) {
72+
b.fail( 'should return a function' );
73+
}
74+
b.pass( 'benchmark finished' );
75+
b.end();
76+
});
77+
78+
// FIXME: add benchmarks

struct/test/test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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 struct = require( './../lib' );
25+
26+
27+
// TESTS //
28+
29+
tape( 'main export is a function', function test( t ) {
30+
t.ok( true, __filename );
31+
t.strictEqual( typeof struct, 'function', 'main export is a function' );
32+
t.end();
33+
});
34+
35+
// FIXME: add tests

0 commit comments

Comments
 (0)