forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_utils.js
More file actions
64 lines (49 loc) · 1.3 KB
/
test_utils.js
File metadata and controls
64 lines (49 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
describe('sdk.tests.math.utils', function () {
it("intToBytes32", function () {
var i, b;
i = 0x11223344;
b = pc.math.intToBytes32(i);
equal(b[0], 0x11);
equal(b[1], 0x22);
equal(b[2], 0x33);
equal(b[3], 0x44);
});
it("intToBytes24", function () {
var i, b;
i = 0x112233;
b = pc.math.intToBytes24(i);
equal(b[0], 0x11);
equal(b[1], 0x22);
equal(b[2], 0x33);
});
it("bytesToInt32", function () {
var i,b;
b = [0xaa, 0xbb, 0xcc, 0xdd];
i = pc.math.bytesToInt32(b);
equal(i, 0xaabbccdd);
});
it("bytesToInt24", function () {
var i,b;
b = [0xaa, 0xbb, 0xcc];
i = pc.math.bytesToInt24(b);
equal(i, 0xaabbcc);
});
it("DEG_TO_RAD", function () {
var deg = 180;
equal(deg * pc.math.DEG_TO_RAD, Math.PI);
});
it("RAD_TO_DEG", function () {
var rad = Math.PI;
equal(rad * pc.math.RAD_TO_DEG, 180);
});
it("smoothstep", function () {
equal(pc.math.smoothstep(0, 10, 0), 0);
equal(pc.math.smoothstep(0, 10, 5), 0.5);
equal(pc.math.smoothstep(0, 10, 10), 1);
});
it("smootherstep", function () {
equal(pc.math.smootherstep(0, 10, 0), 0);
equal(pc.math.smootherstep(0, 10, 5), 0.5);
equal(pc.math.smootherstep(0, 10, 10), 1);
});
});