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