forked from DFHack/dfhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DFHack#5077 from dhthwy/jobid_monotonic_increase_test
test that job ids increase monotonically
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local utils = require('utils') | ||
|
||
config.target = 'core' | ||
config.mode = 'fortress' | ||
|
||
-- EventManager job completion handling expects sorted order | ||
function test.jobIDsAreSorted() | ||
local is_sorted = true | ||
local prev_id = nil | ||
|
||
-- assumes there are at least some "naturally added" jobs currently in the list | ||
-- but this should always be true for CI test saves | ||
for _, job in utils.listpairs(df.global.world.jobs.list) do | ||
if prev_id and job.id < prev_id then | ||
is_sorted = false | ||
break | ||
end | ||
prev_id = job.id | ||
end | ||
|
||
expect.true_(is_sorted) | ||
end |