fix constructor of version with a string argument
[liba.git] / lua / test / trajpoly7.lua
blob6d28df2eb72e169e8ff4db48fb1ab7acebf33f32
1 #!/usr/bin/env lua
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.trajpoly7))
8 local ctx = a.trajpoly7.new(1, 0, 1, 0, 1, 0, 1, 0, 1)
9 assert(ctx)
10 test.dir(getmetatable(ctx))
11 assert(type(a.trajpoly7.pos(ctx, 0.5)) == "number")
12 assert(type(a.trajpoly7.vel(ctx, 0.5)) == "number")
13 assert(type(a.trajpoly7.acc(ctx, 0.5)) == "number")
14 assert(type(a.trajpoly7.jer(ctx, 0.5)) == "number")
15 assert(type(ctx.pos(ctx, 0.5)) == "number")
16 assert(type(ctx.vel(ctx, 0.5)) == "number")
17 assert(type(ctx.acc(ctx, 0.5)) == "number")
18 assert(type(ctx.jer(ctx, 0.5)) == "number")
19 assert(type(ctx:pos(0.5)) == "number")
20 assert(type(ctx:vel(0.5)) == "number")
21 assert(type(ctx:acc(0.5)) == "number")
22 assert(type(ctx:jer(0.5)) == "number")
23 assert(type(ctx.p) == "table")
24 assert(type(ctx.v) == "table")
25 assert(type(ctx.a) == "table")
26 assert(type(ctx.j) == "table")
27 ctx.__name = nil
28 assert(ctx.__name)
29 ctx.__index = nil
30 assert(ctx.__index)
31 ctx.__newindex = nil
32 assert(ctx.__newindex)
33 ---@class a.trajpoly7
34 ---@field __name string
35 ---@field __index table
36 ---@field __newindex table