Skip to content

Commit da61251

Browse files
committed
Make vectorsAreEqual() tests slightly fuzzy
1 parent e3d2617 commit da61251

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/unit/extras/curves/ClosedSplineCurve3.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,22 @@
44

55
module( "ClosedSplineCurve3" );
66

7+
var threshold = 0.000001;
8+
79
function vectorsAreEqual( check, that ) {
810

911
if ( check.length !== that.length ) return 'Length not equal';
1012

1113
for ( var i = 0; i < check.length; i ++ ) {
1214

13-
if ( ! check[ i ] .equals( that[ i ] ) ) {
15+
var a = check[ i ], b = that[ i ];
16+
console.log( a.distanceToSquared( b ) )
17+
18+
if ( a.distanceToSquared( b ) > threshold ) {
1419

15-
return 'Vector differs at index ' + i;
20+
return 'Vector differs at index ' + i +
21+
'. Should be ' + [ a.x, a.y, a.z ] +
22+
' instead of ' + [ b.x, b.y, b.z ];
1623
}
1724
}
1825

@@ -45,7 +52,7 @@ test( "basic check", function() {
4552

4653
var getPoints = closedSpline.getPoints(10);
4754
var error = vectorsAreEqual( getPoints , closedSplinePoints );
48-
ok( getPoints.length == 11, 'getPoints are equal.' + error );
49-
ok( !error, 'Points are equal.' + error );
55+
ok( getPoints.length == 11, 'getPoints should be equal.');
56+
ok( !error, 'Lists of Vectors3 should be equal.' + error );
5057

5158
});

0 commit comments

Comments
 (0)