Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,15 @@ function test.getHackPath_chdir()
expect.eq(clean_path(dfhack.getHackPath()), clean_path(fs.getcwd()))
end)
end

-- validates that the size in df.globals.xml is correct
function test.global_table_size()
local elem_size = df.global_table_entry:sizeof()
local actual_arr_size = 0
while df._displace(df.global.global_table[0], actual_arr_size, elem_size).address do
actual_arr_size = actual_arr_size + 1
end
local declared_arr_size = df.global.global_table:sizeof() // elem_size
expect.eq(declared_arr_size, actual_arr_size,
('global_table size mismatch: expected: %d, actual: %d'):format(declared_arr_size, actual_arr_size))
end
Loading