fix(ludic.jobs): fact records pooled (the ludic.wildlife idiom) - a record per deed that moved a job was never given back

tests: 200 jobs taken and given up make 2 records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 13:17:55 +03:00
parent 36358e7a43
commit 317d63d822
4 changed files with 38 additions and 2 deletions

View file

@ -129,4 +129,17 @@ program JobsGiveUpTest {
jobs_test_st.day = 2
expect(jobs_offered(jobs_st, JOB_CATCH))
}
test "two hundred jobs taken and given up, their facts drained each time, reuse a handful of records" (jobs_st: mut JobsState, jobs_test_st: mut JobsTestState) {
fresh(jobs_st, jobs_test_st)
for k in 0 .. 200 {
jobs_take(jobs_st, JOB_CATCH)
count_of(jobs_st, 0)
jobs_give_up(jobs_st, JOB_CATCH)
count_of(jobs_st, 0)
jobs_st.jobs__back[JOB_CATCH] = -1
}
print(`jobs: 200 taken and given up, {jobs_fact_records(jobs_st)} fact records made`)
expect(jobs_fact_records(jobs_st) < 10)
}
}