add rudimentary testing scripts

This commit is contained in:
Grzegorz Kowalski 2023-02-03 22:02:34 +01:00
parent 7e942585af
commit 2459ea8757
5 changed files with 51 additions and 0 deletions

13
tests/invalid_actions.lua Normal file
View File

@ -0,0 +1,13 @@
local lut = require "lutango"
lut.log:set_log_level(lut.log.level.TRACE)
dp = lut.DeviceProxy(arg[1])
print("Attempting to write core function")
dp.get_attribute_list = 120
print("Attempting to write device command")
dp.SwitchStates = 0
print("Attempting to write read-only attribute")
dp.short_scalar_ro = 100

6
tests/print_versions.lua Normal file
View File

@ -0,0 +1,6 @@
local lut = require "lutango"
print("luTango "..lut.sys.version())
print("Tango "..lut.sys.tango_version())
print(lut.sys.cpp_version())
print(lut.sys.lua_version())

15
tests/read_attrs.lua Normal file
View File

@ -0,0 +1,15 @@
local lut = require "lutango"
lut.log:set_log_level(lut.log.level.WARNING)
dp = lut.DeviceProxy(arg[1])
al = dp:get_attribute_list()
for _,v in ipairs(al) do
if v ~= "no_value" and v ~= "throw_exception" then
io.write(v.." = ")
print(dp[v])
else
print("-- Can't handle that yet: "..v)
end
end

9
tests/run_cmds.lua Normal file
View File

@ -0,0 +1,9 @@
local lut = require "lutango"
lut.log:set_log_level(lut.log.level.TRACE)
dp = lut.DeviceProxy(arg[1])
print(dp:SwitchStates());
print(dp:DevBoolean(true));
print(dp:DevBoolean(false));
print(dp:DevDouble(9.9));

8
tests/write_attrs.lua Normal file
View File

@ -0,0 +1,8 @@
local lut = require "lutango"
lut.log:set_log_level(lut.log.level.WARNING)
dp = lut.DeviceProxy(arg[1])
dp.ampli = dp.ampli + 1
local b = dp.boolean_scalar
dp.boolean_scalar = not b