browser/devtools/tilt/test/browser_tilt_math03.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3 "use strict";
michael@0 4
michael@0 5 function test() {
michael@0 6 let m1 = mat3.create();
michael@0 7
michael@0 8 ok(m1, "Should have created a matrix with mat3.create().");
michael@0 9 is(m1.length, 9, "A mat3 should have 9 elements.");
michael@0 10
michael@0 11 ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
michael@0 12 "When created, a mat3 should have the values default to identity.");
michael@0 13
michael@0 14 mat3.set([1, 2, 3, 4, 5, 6, 7, 8, 9], m1);
michael@0 15 ok(isApproxVec(m1, [1, 2, 3, 4, 5, 6, 7, 8, 9]),
michael@0 16 "The mat3.set() function didn't set the values correctly.");
michael@0 17
michael@0 18 mat3.transpose(m1);
michael@0 19 ok(isApproxVec(m1, [1, 4, 7, 2, 5, 8, 3, 6, 9]),
michael@0 20 "The mat3.transpose() function didn't set the values correctly.");
michael@0 21
michael@0 22 mat3.identity(m1);
michael@0 23 ok(isApproxVec(m1, [1, 0, 0, 0, 1, 0, 0, 0, 1]),
michael@0 24 "The mat3.identity() function didn't set the values correctly.");
michael@0 25
michael@0 26 let m2 = mat3.toMat4(m1);
michael@0 27 ok(isApproxVec(m2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
michael@0 28 "The mat3.toMat4() function didn't set the values correctly.");
michael@0 29
michael@0 30
michael@0 31 is(mat3.str([1, 2, 3, 4, 5, 6, 7, 8, 9]), "[1, 2, 3, 4, 5, 6, 7, 8, 9]",
michael@0 32 "The mat3.str() function didn't work properly.");
michael@0 33 }

mercurial