Browse Source

add another determinant unit tests which utilizes every value of the matrix.

Ben Houston 12 years ago
parent
commit
86feeaeaac
2 changed files with 8 additions and 0 deletions
  1. 4 0
      test/unit/math/Matrix3.js
  2. 4 0
      test/unit/math/Matrix4.js

+ 4 - 0
test/unit/math/Matrix3.js

@@ -133,6 +133,10 @@ test( "determinant", function() {
 
 
 	a.elements[0] = 0;
 	a.elements[0] = 0;
 	ok( a.determinant() == 0, "Passed!" );
 	ok( a.determinant() == 0, "Passed!" );
+
+	// calculated via http://www.euclideanspace.com/maths/algebra/matrix/functions/determinant/threeD/index.htm
+	a.set( 2, 3, 4, 5, 13, 7, 8, 9, 11 );
+	ok( a.determinant() == -73, "Passed!" );
 });
 });
 
 
 
 

+ 4 - 0
test/unit/math/Matrix4.js

@@ -150,6 +150,10 @@ test( "determinant", function() {
 
 
 	a.elements[0] = 0;
 	a.elements[0] = 0;
 	ok( a.determinant() == 0, "Passed!" );
 	ok( a.determinant() == 0, "Passed!" );
+
+	// calculated via http://www.euclideanspace.com/maths/algebra/matrix/functions/determinant/fourD/index.htm
+	a.set( 2, 3, 4, 5, -1, -21, -3, -4, 6, 7, 8, 10, -8, -9, -10, -12 );
+	ok( a.determinant() == 76, "Passed!" );
 });
 });
 
 
 test( "getInverse", function() {
 test( "getInverse", function() {