2222
2323var tape = require ( 'tape' ) ;
2424var Float64Array = require ( '@stdlib/array/float64' ) ;
25- var isAlmostSameValue = require ( '@stdlib/assert/is-almost-same-value' ) ;
25+ var isAlmostSameValueFloat64Array = require ( '@stdlib/assert/is-almost-same-value-float64array ' ) ;
2626var PINF = require ( '@stdlib/constants/float64/pinf' ) ;
2727var dlasv2 = require ( './../lib/dlasv2.js' ) ;
2828
@@ -39,27 +39,6 @@ var DIA_MAT = require( './fixtures/diagonal_matrix.json' );
3939var G_GT_F_AND_H = require ( './fixtures/g_gt_f_and_h.json' ) ;
4040
4141
42- // FUNCTIONS //
43-
44- /**
45- * Tests for element-wise approximate equality.
46- *
47- * @private
48- * @param {Object } t - test object
49- * @param {Collection } actual - actual values
50- * @param {Collection } expected - expected values
51- * @param {number } maxULPs - maximum allowed ULP difference
52- */
53- function isApprox ( t , actual , expected , maxULPs ) {
54- var i ;
55-
56- t . strictEqual ( actual . length , expected . length , 'returns expected value' ) ;
57- for ( i = 0 ; i < expected . length ; i ++ ) {
58- t . strictEqual ( isAlmostSameValue ( actual [ i ] , expected [ i ] , maxULPs ) , true , 'returns expected value' ) ;
59- }
60- }
61-
62-
6342// TESTS //
6443
6544tape ( 'main export is a function' , function test ( t ) {
@@ -83,8 +62,8 @@ tape( 'the function computes the singular value decomposition of a triangular ma
8362 out = new Float64Array ( 6 ) ;
8463
8564 dlasv2 ( data . F , data . G , data . H , out ) ;
86- expected = data . out ;
87- isApprox ( t , out , expected , 1 ) ;
65+ expected = new Float64Array ( data . out ) ;
66+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
8867 t . end ( ) ;
8968} ) ;
9069
@@ -98,8 +77,8 @@ tape( 'the function computes the singular value decomposition of a triangular ma
9877 out = new Float64Array ( 6 ) ;
9978
10079 dlasv2 ( data . F , data . G , data . H , out ) ;
101- expected = data . out ;
102- isApprox ( t , out , expected , 1 ) ;
80+ expected = new Float64Array ( data . out ) ;
81+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
10382 t . end ( ) ;
10483} ) ;
10584
@@ -113,8 +92,8 @@ tape( 'the function computes the singular value decomposition of a triangular ma
11392 out = new Float64Array ( 6 ) ;
11493
11594 dlasv2 ( data . F , data . G , data . H , out ) ;
116- expected = data . out ;
117- isApprox ( t , out , expected , 1 ) ;
95+ expected = new Float64Array ( data . out ) ;
96+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
11897 t . end ( ) ;
11998} ) ;
12099
@@ -128,8 +107,8 @@ tape( 'the function computes the singular value decomposition of a diagonal matr
128107 out = new Float64Array ( 6 ) ;
129108
130109 dlasv2 ( data . F , data . G , data . H , out ) ;
131- expected = data . out ;
132- isApprox ( t , out , expected , 1 ) ;
110+ expected = new Float64Array ( data . out ) ;
111+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
133112 t . end ( ) ;
134113} ) ;
135114
@@ -143,8 +122,8 @@ tape( 'the function computes the singular value decomposition of a diagonal matr
143122 out = new Float64Array ( 6 ) ;
144123
145124 dlasv2 ( data . F , data . G , data . H , out ) ;
146- expected = data . out ;
147- isApprox ( t , out , expected , 1 ) ;
125+ expected = new Float64Array ( data . out ) ;
126+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
148127 t . end ( ) ;
149128} ) ;
150129
@@ -158,8 +137,8 @@ tape( 'the function computes the singular value decomposition of a diagonal matr
158137 out = new Float64Array ( 6 ) ;
159138
160139 dlasv2 ( data . F , data . G , data . H , out ) ;
161- expected = data . out ;
162- isApprox ( t , out , expected , 1 ) ;
140+ expected = new Float64Array ( data . out ) ;
141+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
163142 t . end ( ) ;
164143} ) ;
165144
@@ -170,7 +149,7 @@ tape( 'the function computes the singular value decomposition of a diagonal matr
170149 expected = new Float64Array ( [ 1.0 , PINF , 0.0 , 1.0 , 0.0 , 1.0 ] ) ;
171150 out = new Float64Array ( 6 ) ;
172151 out = dlasv2 ( PINF , 2.0 , 1.0 , out ) ;
173- isApprox ( t , out , expected , 1 ) ;
152+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
174153 t . end ( ) ;
175154} ) ;
176155
@@ -184,7 +163,7 @@ tape( 'the function computes the singular value decomposition of a diagonal matr
184163 out = new Float64Array ( 6 ) ;
185164
186165 dlasv2 ( data . F , data . G , data . H , out ) ;
187- expected = data . out ;
188- isApprox ( t , out , expected , 1 ) ;
166+ expected = new Float64Array ( data . out ) ;
167+ t . strictEqual ( isAlmostSameValueFloat64Array ( out , expected , 1 ) , true , 'returns expected value' ) ;
189168 t . end ( ) ;
190169} ) ;
0 commit comments