remove gcc for MacOS in conan.yml
[liba.git] / lua / test / lpf.lua
blob9a879898133c3fa0c4f8fba7342ad5966520b3ba
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.lpf))
8 local ctx = a.lpf.new(0.1)
9 assert(ctx)
10 local ctx = a.lpf.new(10, 0.01)
11 assert(ctx)
12 test.dir(getmetatable(ctx))
13 assert(type(a.lpf.gen(ctx, 10, 0.01)) == "userdata")
14 assert(type(a.lpf.gen(ctx, 0.1)) == "userdata")
15 assert(type(a.lpf.iter(ctx, 1)) == "number")
16 assert(type(a.lpf.zero(ctx)) == "userdata")
17 assert(type(ctx.gen(ctx, 10, 0.01)) == "userdata")
18 assert(type(ctx.gen(ctx, 0.1)) == "userdata")
19 assert(type(ctx.iter(ctx, 1)) == "number")
20 assert(type(ctx.zero(ctx)) == "userdata")
21 assert(type(ctx:gen(10, 0.01)) == "userdata")
22 assert(type(ctx:gen(0.1)) == "userdata")
23 assert(type(ctx:iter(1)) == "number")
24 assert(type(ctx:zero()) == "userdata")
25 assert(type(ctx.alpha) == "number")
26 assert(type(ctx.output) == "number")
27 ctx.__name = nil
28 assert(ctx.__name)
29 ctx.__call = nil
30 assert(ctx.__call)
31 ctx.__index = nil
32 assert(ctx.__index)
33 ctx.__newindex = nil
34 assert(ctx.__newindex)
35 ---@class a.lpf
36 ---@field __name string
37 ---@field __call function
38 ---@field __index table
39 ---@field __newindex table