From a2a7471f88a8c0f5c710d5ffb90511fc54b432d7 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 27 May 2026 21:40:43 -0500 Subject: refactor: take card-state in org-drill-determine-next-interval-sm5 Stage 4 of #147. sm5 now takes (state quality of-matrix &optional delta-days) instead of nine positional args, binding the recall fields from the struct at the top so the algorithm body is unchanged. Both call-site branches pass the state they already hold, dropping the per-branch accessor unpacking. The testutil adapter test-scheduler--call-sm5 keeps the sm5 test calls a one-symbol rename per site. I also kept the return as the existing list, matching the stage-3 refinement: the goal is reducing the input signature, and changing the return shape would force the shared return-extractors and every return-read to change for no real gain. Also folds in two stage-3 follow-ons I missed when sm2 landed: a direct sm5 call in tests/test-org-drill-small-branch-coverage.el now uses the new struct API inline, and five direct sm2 calls in the simple-workflow integration test now go through the testutil adapter (the integration file picks up the testutil-scheduler require). Caught by running make test-integration this stage, which I should have run on the sm2 stage. --- tests/testutil-scheduler.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/testutil-scheduler.el') diff --git a/tests/testutil-scheduler.el b/tests/testutil-scheduler.el index 70204b4..0d28b7a 100644 --- a/tests/testutil-scheduler.el +++ b/tests/testutil-scheduler.el @@ -57,5 +57,14 @@ Use this name in Simple8 tests where the field is called `ease' not `ef'." :failures failures :meanq meanq :total-repeats total-repeats) quality)) +(defun test-scheduler--call-sm5 (last-interval n ef quality failures meanq + total-repeats of-matrix &optional delta-days) + "Call the SM5 scheduler from positional args, packing them into a card-state." + (org-drill-determine-next-interval-sm5 + (make-org-drill-card-state + :last-interval last-interval :repetitions n :ease ef + :failures failures :meanq meanq :total-repeats total-repeats) + quality of-matrix delta-days)) + (provide 'testutil-scheduler) ;;; testutil-scheduler.el ends here -- cgit v1.2.3