3 ---@diagnostic disable: redefined-local
4 package
.path
= arg
[0]:sub(0, -arg
[0]:match("([^/\\]*)$"):len() - 1) .. "?.lua;" .. package
.path
5 local test
= require("test")
6 local a
= require("liba")
7 test
.dir(getmetatable(a
.trajtrap
))
8 local ctx
= a
.trajtrap
.new()
10 test
.dir(getmetatable(ctx
))
11 assert(a
.trajtrap
.gen(ctx
, 2, 2, -2, 0, 4) > 0)
12 assert(type(a
.trajtrap
.pos(ctx
, 0.5)) == "number")
13 assert(type(a
.trajtrap
.vel(ctx
, 0.5)) == "number")
14 assert(type(a
.trajtrap
.acc(ctx
, 0.5)) == "number")
15 assert(ctx
.gen(ctx
, 2, 2, -2, 0, 4) > 0)
16 assert(type(ctx
.pos(ctx
, 0.5)) == "number")
17 assert(type(ctx
.vel(ctx
, 0.5)) == "number")
18 assert(type(ctx
.acc(ctx
, 0.5)) == "number")
19 assert(ctx
:gen(2, 2, -2, 0, 4) > 0)
20 assert(type(ctx
:pos(0.5)) == "number")
21 assert(type(ctx
:vel(0.5)) == "number")
22 assert(type(ctx
:acc(0.5)) == "number")
23 assert(type(ctx
.t
) == "number")
24 assert(type(ctx
.p0
) == "number")
25 assert(type(ctx
.p1
) == "number")
26 assert(type(ctx
.v0
) == "number")
27 assert(type(ctx
.v1
) == "number")
28 assert(type(ctx
.vc
) == "number")
29 assert(type(ctx
.ta
) == "number")
30 assert(type(ctx
.td
) == "number")
31 assert(type(ctx
.pa
) == "number")
32 assert(type(ctx
.pd
) == "number")
33 assert(type(ctx
.ac
) == "number")
34 assert(type(ctx
.de
) == "number")
40 assert(ctx
.__newindex
)
42 ---@field __name string
43 ---@field __index table
44 ---@field __newindex table