browser/devtools/tilt/test/browser_tilt_math03.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/tilt/test/browser_tilt_math03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +"use strict";
     1.7 +
     1.8 +function test() {
     1.9 +  let m1 = mat3.create();
    1.10 +
    1.11 +  ok(m1, "Should have created a matrix with mat3.create().");
    1.12 +  is(m1.length, 9, "A mat3 should have 9 elements.");
    1.13 +
    1.14 +  ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
    1.15 +    "When created, a mat3 should have the values default to identity.");
    1.16 +
    1.17 +  mat3.set([1, 2, 3, 4, 5, 6, 7, 8, 9], m1);
    1.18 +  ok(isApproxVec(m1, [1, 2, 3, 4, 5, 6, 7, 8, 9]),
    1.19 +    "The mat3.set() function didn't set the values correctly.");
    1.20 +
    1.21 +  mat3.transpose(m1);
    1.22 +  ok(isApproxVec(m1, [1, 4, 7, 2, 5, 8, 3, 6, 9]),
    1.23 +    "The mat3.transpose() function didn't set the values correctly.");
    1.24 +
    1.25 +  mat3.identity(m1);
    1.26 +  ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
    1.27 +    "The mat3.identity() function didn't set the values correctly.");
    1.28 +
    1.29 +  let m2 = mat3.toMat4(m1);
    1.30 +  ok(isApproxVec(m2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
    1.31 +    "The mat3.toMat4() function didn't set the values correctly.");
    1.32 +
    1.33 +
    1.34 +  is(mat3.str([1, 2, 3, 4, 5, 6, 7, 8, 9]), "[1, 2, 3, 4, 5, 6, 7, 8, 9]",
    1.35 +    "The mat3.str() function didn't work properly.");
    1.36 +}

mercurial