Skip to content

Commit 2452892

Browse files
committed
lacpi: Test files
1 parent e94a52a commit 2452892

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

stand/lua/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ FILES= cli.lua \
2929
gfx-orbbw.lua \
3030
menu.lua \
3131
password.lua \
32+
object.lua \
33+
walk.lua \
3234
screen.lua
3335

3436
.include <bsd.prog.mk>

stand/lua/object.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
local lacpi = require("lacpi")
2+
3+
local function test_get_handle()
4+
print("----VERIFYING HANDLE----")
5+
local handle = lacpi.object.get_handle("\\_SB")
6+
print(tostring(handle))
7+
local verify = lacpi.object.verify(handle)
8+
if verify then
9+
print(tostring(handle) .. " is a lacpi_node")
10+
11+
else
12+
print(tostring(handle) .. " is not a lacpi_node")
13+
end
14+
end
15+
16+
print("---TEST BEGIN: OBJECT---")
17+
18+
test_get_handle()
19+
20+
print("-----TESTS COMPLETE-----")

stand/lua/walk.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
local function test_walk_namespace()
2+
local nodes = lacpi.walk.namespace() -- returns table of tables
3+
4+
if nodes == nil then
5+
return "FAILURE: Nodes were nil"
6+
end
7+
8+
-- Print them in Lua
9+
for _, node in ipairs(nodes) do
10+
print(node.level, node.path, node.HID or "", node.UID or "")
11+
end
12+
13+
return "SUCCESS"
14+
end
15+
16+
print("--- TEST BEGIN: WALK NS ---")
17+
18+
status = test_walk_namespace()
19+
20+
print("--- TEST END: WALK NS ---")
21+
print(status)

0 commit comments

Comments
 (0)