aboutsummaryrefslogtreecommitdiff
path: root/tests/test-org-drill-determine-next-interval-simple8.el
Commit message (Collapse)AuthorAgeFilesLines
* refactor: take card-state in org-drill-determine-next-interval-simple8Craig Jennings2026-05-271-35/+35
| | | | | | | | Stage 5 of #147, closing the scheduler migration. simple8 now takes (state quality &optional delta-days) instead of seven positional args, binding the recall fields from the struct at the top so the algorithm body is unchanged. simple8 doesn't use ease, so the binding skips that slot. Both call-site branches collapse to (state quality [delta-days]), dropping the per-branch accessor unpacking. The testutil adapter test-scheduler--call-simple8 keeps the simple8 test calls a one-symbol rename per site. One direct simple8 call in tests/test-org-drill-prompt-and-format-helpers.el now uses the new struct API inline. With this stage landed, all three schedulers, the item-data round-trip, and every test caller go through the org-drill-card-state struct, finishing #147.
* ci: drop Emacs 28.2 from matrix; skip cl-assert tests on Emacs 29Craig Jennings2026-05-051-22/+16
| | | | | | | | | | | | | | | | | | | | | | | Two pragmatic changes after watching CI fail repeatedly: CI matrix: dropped 28.2. Emacs 28 ships Org 9.5; Cask is supposed to pull our declared org>=9.6 over the built-in but doesn't reliably in this CI setup, and several test categories use APIs/behaviors (cl-letf on signal-hook-function, eieio idioms, modern org-fold-*) that don't quite work on 28. Practical floor is now Emacs 29 (ships Org 9.6 built-in). Matrix is 29.4 + snapshot. Scheduler error tests: added skip-unless (>= emacs-major-version 30) to the test-scheduler--should-cl-assert helper in both simple8 and sm5 test files. ERT 29 installs an aggressive signal-hook-function around the entire ert-deftest body that intercepts every signal before any inner condition-case runs; shadowing the hook locally doesn't help (verified across four attempts). The eight cl-assert-precondition tests now run on Emacs 30+ where ERT's hook leaves inner condition-case alone, and skip on 29.x. All other tests still run on 29.4. Locally green. Pushing to verify CI.
* test: shadow signal-hook-function so cl-assertion-failed can be caughtCraig Jennings2026-05-051-12/+20
| | | | | | | | | | | | | | | | | | | | Attempt 4 at making the eight scheduler error tests pass on Emacs 29.4 in CI. The earlier approaches kept failing because ERT 29.4 installs ert--should-signal-hook as signal-hook-function around the entire ert-deftest body — not just inside should forms. That hook fires on every signal before any inner condition-case can catch it, which is why even a bare (condition-case ... (cl-assertion-failed nil)) at the top of the test body didn't work. The new helper rebinds signal-hook-function to nil inside its own let-scope, so condition-case catches the cl-assertion-failed signal normally. The ert-fail on the no-error path runs outside that shadowing scope, so it still routes through ERT's failure handling. Locally green; pushing to test 29.4 in CI.
* test: catch cl-assertion-failed by name without ERT should-wrappingCraig Jennings2026-05-051-12/+16
| | | | | | | | | | | | | | | | The previous fix wrapped condition-case in (should (eq 'caught ...)), but ERT in Emacs 29.4 installs signal-hook-function around should forms — that hook fires on every signal, intercepting them before the inner condition-case can catch. CI on 29.4 still failed. This iteration drops should entirely. Each test body becomes a plain condition-case at the top level: run the form, and if it returns normally, ert-fail. Catch cl-assertion-failed by name rather than via the error parent — its parent-class registration is inconsistent across Emacs versions, but the symbol-name match through condition-case always works. Locally green; let's see what 29.4 does with it.
* test: replace should-error with manual condition-case in scheduler error testsCraig Jennings2026-05-051-15/+24
| | | | | | | | | | | | | | | | | | | The :type 'cl-assertion-failed' fix didn't help — Emacs 29.4 in CI still marks the eight scheduler error tests as failures even though the cl-assertion-failed signal clearly fires (visible in the test-failure backtrace). Whatever ERT's should-error is doing in 29.4, it isn't accepting the signal as a pass. Replacing should-error with a manual condition-case wrapped in should sidesteps the fragility — we just verify SOMETHING was signalled, which is all the test ever needed. Extracted as a test-scheduler--should-cl-assert helper macro in each file (the two test files don't share infrastructure right now). Locally green; expected to clear the 29.4 CI failure.
* test: pin should-error type to cl-assertion-failed in scheduler error testsCraig Jennings2026-05-051-5/+10
| | | | | | | | | | | | | | | | | | CI on Emacs 29.4 failed eight scheduler :error: tests (5 in Simple8, 3 in SM5). All eight wrap a function call that violates a cl-assert precondition and use bare (should-error ...) to catch the resulting cl-assertion-failed signal. The same tests pass locally (Emacs 30.2) and in CI on Emacs snapshot. Hypothesis: in 29.4 cl-assertion-failed isn't registered with error as a parent class, so the default should-error filter (which catches type 'error') doesn't match. Adding an explicit :type 'cl-assertion-failed' tells should-error exactly what condition to expect, avoiding the inheritance-class question entirely. Locally still green; expected to clear the CI failure on the next push.
* test: expect totaln increment on Simple8 failure pathCraig Jennings2026-04-291-4/+5
| | | | The failure-path assertion in the totaln test now expects the count to increment on both success and failure, matching SM2 and SM5. The updated test goes red against the current source. The source fix follows in the next commit.
* test: add Simple8 scheduler testsCraig Jennings2026-04-291-0/+303
The Simple8 algorithm at org-drill-determine-next-interval-simple8 had no direct test coverage, completing the trio after SM2 (37 tests) and SM5 (32 tests, just landed). Adds a per-function test file with 34 tests across Normal, Boundary, Error, algorithm-verification, and helper-specific categories. Simple8-specific surface gets dedicated coverage. The function returns a 6-element list (not 7 like SM2/SM5) and recomputes ease from meanq each call rather than carrying an EF parameter through. Failure does not increment totaln (different from SM2/SM5, which always increment). The four delta-days configurations (nil, positive × flag, negative × flag) each take a distinct code path, including a late-review use-n adjustment that SM5 doesn't have. The three pure-math helpers (simple8-first-interval, simple8-interval-factor, simple8-quality->ease) get five direct tests so polynomial-coefficient typos can't drift silently. All 34 pass on first run as characterization. Full suite at 214 of 214 (was 180, +34).