michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: "use strict"; michael@0: michael@0: function test() { michael@0: let m1 = mat3.create(); michael@0: michael@0: ok(m1, "Should have created a matrix with mat3.create()."); michael@0: is(m1.length, 9, "A mat3 should have 9 elements."); michael@0: michael@0: ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]), michael@0: "When created, a mat3 should have the values default to identity."); michael@0: michael@0: mat3.set([1, 2, 3, 4, 5, 6, 7, 8, 9], m1); michael@0: ok(isApproxVec(m1, [1, 2, 3, 4, 5, 6, 7, 8, 9]), michael@0: "The mat3.set() function didn't set the values correctly."); michael@0: michael@0: mat3.transpose(m1); michael@0: ok(isApproxVec(m1, [1, 4, 7, 2, 5, 8, 3, 6, 9]), michael@0: "The mat3.transpose() function didn't set the values correctly."); michael@0: michael@0: mat3.identity(m1); michael@0: ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]), michael@0: "The mat3.identity() function didn't set the values correctly."); michael@0: michael@0: let m2 = mat3.toMat4(m1); michael@0: ok(isApproxVec(m2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), michael@0: "The mat3.toMat4() function didn't set the values correctly."); michael@0: michael@0: michael@0: is(mat3.str([1, 2, 3, 4, 5, 6, 7, 8, 9]), "[1, 2, 3, 4, 5, 6, 7, 8, 9]", michael@0: "The mat3.str() function didn't work properly."); michael@0: }