File tree Expand file tree Collapse file tree 2 files changed +113
-0
lines changed
lib/node_modules/@stdlib/dstructs/struct Expand file tree Collapse file tree 2 files changed +113
-0
lines changed Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments