2020
2121// MODULES //
2222
23- var tape = require ( 'tape' ) ;
24- var Float64Array = require ( '@stdlib/array/float64' ) ;
25- var ndarray = require ( '@stdlib/ndarray/base/ctor' ) ;
26- var getData = require ( '@stdlib/ndarray/base/data-buffer' ) ;
27- var dfill = require ( './../lib' ) ;
23+ var tape = require ( 'tape' ) ;
24+ var Float64Array = require ( '@stdlib/array/float64' ) ;
25+ var ndarray = require ( '@stdlib/ndarray/base/ctor' ) ;
26+ var getData = require ( '@stdlib/ndarray/base/data-buffer' ) ;
27+ var dfill = require ( './../lib' ) ;
2828
2929
3030// FUNCTIONS //
@@ -39,62 +39,62 @@ var dfill = require('./../lib');
3939* @param {NonNegativeInteger } offset - index offset
4040* @returns {ndarray } one-dimensional ndarray
4141*/
42- function vector ( buffer , length , stride , offset ) {
43- return new ndarray ( 'float64' , buffer , [ length ] , [ stride ] , offset , 'row-major' ) ;
42+ function vector ( buffer , length , stride , offset ) {
43+ return new ndarray ( 'float64' , buffer , [ length ] , [ stride ] , offset , 'row-major' ) ;
4444}
4545
4646
4747// TESTS //
4848
49- tape ( 'main export is a function' , function test ( t ) {
50- t . ok ( true , __filename ) ;
51- t . strictEqual ( typeof dfill , 'function' , 'main export is a function' ) ;
49+ tape ( 'main export is a function' , function test ( t ) {
50+ t . ok ( true , __filename ) ;
51+ t . strictEqual ( typeof dfill , 'function' , 'main export is a function' ) ;
5252 t . end ( ) ;
5353} ) ;
5454
55- tape ( 'the function has an arity of 2' , function test ( t ) {
56- t . strictEqual ( dfill . length , 2 , 'has expected arity' ) ;
55+ tape ( 'the function has an arity of 2' , function test ( t ) {
56+ t . strictEqual ( dfill . length , 2 , 'has expected arity' ) ;
5757 t . end ( ) ;
5858} ) ;
5959
60- tape ( 'the function fills a one-dimensional ndarray with a specified scalar constant' , function test ( t ) {
60+ tape ( 'the function fills a one-dimensional ndarray with a specified scalar constant' , function test ( t ) {
6161 var expected ;
6262 var x ;
6363
64- x = new Float64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] ) ;
65- expected = new Float64Array ( [ 5.0 , 5.0 , 5.0 , 5.0 , 5.0 , 5.0 ] ) ;
64+ x = new Float64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] ) ;
65+ expected = new Float64Array ( [ 5.0 , 5.0 , 5.0 , 5.0 , 5.0 , 5.0 ] ) ;
6666
67- dfill ( 5.0 , [ vector ( x , 6 , 1 , 0 ) ] ) ;
68- t . deepEqual ( x , expected , 'returns expected value' ) ;
67+ dfill ( 5.0 , [ vector ( x , 6 , 1 , 0 ) ] ) ;
68+ t . deepEqual ( x , expected , 'returns expected value' ) ;
6969
7070 t . end ( ) ;
7171} ) ;
7272
73- tape ( 'the function returns the input ndarray' , function test ( t ) {
73+ tape ( 'the function returns the input ndarray' , function test ( t ) {
7474 var x ;
7575 var y ;
7676
77- x = new Float64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] ) ;
78- y = dfill ( 5.0 , [ vector ( x , 6 , 1 , 0 ) ] ) ;
77+ x = new Float64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] ) ;
78+ y = dfill ( 5.0 , [ vector ( x , 6 , 1 , 0 ) ] ) ;
7979
80- t . strictEqual ( getData ( y ) , x , 'returns expected value' ) ;
80+ t . strictEqual ( getData ( y ) , x , 'returns expected value' ) ;
8181 t . end ( ) ;
8282} ) ;
8383
84- tape ( 'if provided an empty ndarray, the function returns the input ndarray unchanged' , function test ( t ) {
84+ tape ( 'if provided an empty ndarray, the function returns the input ndarray unchanged' , function test ( t ) {
8585 var expected ;
8686 var x ;
8787
88- x = new Float64Array ( [ ] ) ;
89- expected = new Float64Array ( [ ] ) ;
88+ x = new Float64Array ( [ ] ) ;
89+ expected = new Float64Array ( [ ] ) ;
9090
91- dfill ( 5.0 , [ vector ( x , 0 , 1 , 0 ) ] ) ;
92- t . deepEqual ( x , expected , 'returns expected value' ) ;
91+ dfill ( 5.0 , [ vector ( x , 0 , 1 , 0 ) ] ) ;
92+ t . deepEqual ( x , expected , 'returns expected value' ) ;
9393
9494 t . end ( ) ;
9595} ) ;
9696
97- tape ( 'the function supports one-dimensional ndarrays having non-unit strides' , function test ( t ) {
97+ tape ( 'the function supports one-dimensional ndarrays having non-unit strides' , function test ( t ) {
9898 var expected ;
9999 var x ;
100100
@@ -108,15 +108,15 @@ tape('the function supports one-dimensional ndarrays having non-unit strides', f
108108 4.0 , // 3
109109 2.0
110110 ] ) ;
111- expected = new Float64Array ( [ 5.0 , 2.0 , 5.0 , - 7.0 , 5.0 , 3.0 , 5.0 , 2.0 ] ) ;
111+ expected = new Float64Array ( [ 5.0 , 2.0 , 5.0 , - 7.0 , 5.0 , 3.0 , 5.0 , 2.0 ] ) ;
112112
113- dfill ( 5.0 , [ vector ( x , 4 , 2 , 0 ) ] ) ;
113+ dfill ( 5.0 , [ vector ( x , 4 , 2 , 0 ) ] ) ;
114114
115- t . deepEqual ( x , expected , 'returns expected value' ) ;
115+ t . deepEqual ( x , expected , 'returns expected value' ) ;
116116 t . end ( ) ;
117117} ) ;
118118
119- tape ( 'the function supports one-dimensional ndarrays having negative strides' , function test ( t ) {
119+ tape ( 'the function supports one-dimensional ndarrays having negative strides' , function test ( t ) {
120120 var expected ;
121121 var x ;
122122
@@ -130,15 +130,15 @@ tape('the function supports one-dimensional ndarrays having negative strides', f
130130 4.0 , // 0
131131 2.0
132132 ] ) ;
133- expected = new Float64Array ( [ 5.0 , 2.0 , 5.0 , - 7.0 , 5.0 , 3.0 , 5.0 , 2.0 ] ) ;
133+ expected = new Float64Array ( [ 5.0 , 2.0 , 5.0 , - 7.0 , 5.0 , 3.0 , 5.0 , 2.0 ] ) ;
134134
135- dfill ( 5.0 , [ vector ( x , 4 , - 2 , 6 ) ] ) ;
135+ dfill ( 5.0 , [ vector ( x , 4 , - 2 , 6 ) ] ) ;
136136
137- t . deepEqual ( x , expected , 'returns expected value' ) ;
137+ t . deepEqual ( x , expected , 'returns expected value' ) ;
138138 t . end ( ) ;
139139} ) ;
140140
141- tape ( 'the function supports one-dimensional ndarrays having non-zero offsets' , function test ( t ) {
141+ tape ( 'the function supports one-dimensional ndarrays having non-zero offsets' , function test ( t ) {
142142 var expected ;
143143 var x ;
144144
@@ -152,10 +152,10 @@ tape('the function supports one-dimensional ndarrays having non-zero offsets', f
152152 3.0 ,
153153 4.0 // 3
154154 ] ) ;
155- expected = new Float64Array ( [ 2.0 , 5.0 , 2.0 , 5.0 , - 2.0 , 5.0 , 3.0 , 5.0 ] ) ;
155+ expected = new Float64Array ( [ 2.0 , 5.0 , 2.0 , 5.0 , - 2.0 , 5.0 , 3.0 , 5.0 ] ) ;
156156
157- dfill ( 5.0 , [ vector ( x , 4 , 2 , 1 ) ] ) ;
158- t . deepEqual ( x , expected , 'returns expected value' ) ;
157+ dfill ( 5.0 , [ vector ( x , 4 , 2 , 1 ) ] ) ;
158+ t . deepEqual ( x , expected , 'returns expected value' ) ;
159159
160160 t . end ( ) ;
161161} ) ;
0 commit comments