update README.md in javascript
[liba.git] / javascript / test / trajpoly5.js
blob633ea373596d8046a2e2fa8b1be945dcc92ab915
1 #!/usr/bin/env node
2 var liba = require("../liba");
3 function assert(expr) {
4 if (!eval(expr)) {
5 throw Error(expr);
8 function do_leak_check() {
9 for (const arg of arguments) {
10 arg.delete();
12 if (liba.do_leak_check) {
13 liba.do_leak_check();
16 var ctx = new liba.trajpoly5(1, 0, 1, 0, 1, 0, 1);
17 assert("ctx.p");
18 assert("ctx.v");
19 assert("ctx.a");
20 for (var i = 0; i < 1; i += 0.1) {
21 console.log(i, ctx.pos(i), ctx.vel(i), ctx.acc(i));
23 do_leak_check(ctx);