remove gcc for MacOS in conan.yml
[liba.git] / lua / test / hpf.lua
blob4e17c52c1feb8dd2a69800879451368da6cfaa5b
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.hpf))
8 local ctx = a.hpf.new(0.1)
9 assert(ctx)
10 local ctx = a.hpf.new(10, 0.01)
11 assert(ctx)
12 test.dir(getmetatable(ctx))
13 assert(type(a.hpf.gen(ctx, 10, 0.01)) == "userdata")
14 assert(type(a.hpf.gen(ctx, 0.1)) == "userdata")
15 assert(type(a.hpf.iter(ctx, 1)) == "number")
16 assert(type(a.hpf.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 assert(type(ctx.input) == "number")
28 ctx.__name = nil
29 assert(ctx.__name)
30 ctx.__call = nil
31 assert(ctx.__call)
32 ctx.__index = nil
33 assert(ctx.__index)
34 ctx.__newindex = nil
35 assert(ctx.__newindex)
36 ---@class a.hpf
37 ---@field __name string
38 ---@field __call function
39 ---@field __index table
40 ---@field __newindex table