Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3 "use strict";
5 function test() {
6 let q1 = quat4.create();
8 ok(q1, "Should have created a quaternion with quat4.create().");
9 is(q1.length, 4, "A quat4 should have 4 elements.");
11 ok(isApproxVec(q1, [0, 0, 0, 1]),
12 "When created, a vec3 should have the values default to identity.");
14 quat4.set([1, 2, 3, 4], q1);
15 ok(isApproxVec(q1, [1, 2, 3, 4]),
16 "The quat4.set() function didn't set the values correctly.");
18 quat4.identity(q1);
19 ok(isApproxVec(q1, [0, 0, 0, 1]),
20 "The quat4.identity() function didn't set the values correctly.");
22 quat4.set([5, 6, 7, 8], q1);
23 ok(isApproxVec(q1, [5, 6, 7, 8]),
24 "The quat4.set() function didn't set the values correctly.");
26 quat4.calculateW(q1);
27 ok(isApproxVec(q1, [5, 6, 7, -10.440306663513184]),
28 "The quat4.calculateW() function didn't compute the values correctly.");
30 quat4.inverse(q1);
31 ok(isApproxVec(q1, [-5, -6, -7, -10.440306663513184]),
32 "The quat4.inverse() function didn't compute the values correctly.");
34 quat4.normalize(q1);
35 ok(isApproxVec(q1, [
36 -0.33786869049072266, -0.40544241666793823,
37 -0.4730161726474762, -0.7054905295372009
38 ]), "The quat4.normalize() function didn't compute the values correctly.");
40 ok(isApprox(quat4.length(q1), 1),
41 "The mat4.length() function didn't calculate the value correctly.");
42 }