update source of liba-dev-1.rockspec
[liba.git] / quickjs / test / trajtrap.js
blobbc6a7a696a1d077cbfbcd393be257fe4b0e8628f
1 import * as a from "liba.so";
2 function assert(expr) {
3 if (!eval(expr)) {
4 throw Error(expr);
7 var ctx = new a.trajtrap();
8 assert("ctx.gen(2, 2, -2, 0, 4) != undefined");
9 assert("ctx.t != undefined");
10 assert("ctx.p0 != undefined");
11 assert("ctx.p1 != undefined");
12 assert("ctx.v0 != undefined");
13 assert("ctx.v1 != undefined");
14 assert("ctx.vc != undefined");
15 assert("ctx.ta != undefined");
16 assert("ctx.td != undefined");
17 assert("ctx.pa != undefined");
18 assert("ctx.pd != undefined");
19 assert("ctx.ac != undefined");
20 assert("ctx.de != undefined");
21 for (var i = 0; i < ctx.t; i += ctx.t / 10) {
22 console.log(i, ctx.pos(i), ctx.vel(i), ctx.acc(i));