2023-08-04 10:59:08 -06:00
|
|
|
config.target = 'core'
|
2023-08-04 00:54:14 -06:00
|
|
|
|
2020-04-01 00:30:55 -06:00
|
|
|
local utils = require('utils')
|
|
|
|
|
|
|
|
function test.unit_action_fields()
|
|
|
|
dfhack.with_temp_object(df.unit_action:new(), function(action)
|
|
|
|
for k in pairs(action.data) do
|
2021-03-23 19:24:57 -06:00
|
|
|
expect.eq(utils.addressof(action.data.raw_data), utils.addressof(action.data:_field(k)),
|
2020-04-01 00:30:55 -06:00
|
|
|
'address of ' .. k .. ' does not match')
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
function test.unit_action_type()
|
|
|
|
dfhack.with_temp_object(df.unit_action:new(), function(action)
|
2021-03-23 19:24:57 -06:00
|
|
|
for index, name in ipairs(df.unit_action_type) do
|
|
|
|
expect.true_(name, "unit_action_type entry without name: " .. tostring(index))
|
|
|
|
local tag = df.unit_action_type.attrs[name].tag
|
|
|
|
expect.true_(tag, "unit_action_type entry missing tag: name=" .. name)
|
2021-03-30 14:55:06 -06:00
|
|
|
action.type = index
|
2021-03-23 19:24:57 -06:00
|
|
|
expect.pairs_contains(action.data, tag,
|
|
|
|
"unit_action_type entry missing from unit_action.data: name=" .. name)
|
2020-04-01 00:30:55 -06:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|