AtlatestRepositoryfolio

folio / tree / testf1a-coverage-probe.sgl

1;;; Prints one line per DISTINCT node kind the pressure manuscript exercises.
2;;;
3;;; The gate derives the frozen vocabulary independently, from the
4;;; `define-struct` lines in `src/folio/doc/model.sgl`, and requires every kind
5;;; to appear here. Neither side hardcodes the list, so adding a record to the
6;;; model without putting it in the manuscript fails the gate instead of quietly
7;;; shipping an unexercised node.
8;;;
9;;; This is the "enumerate, do not sample" requirement made mechanical: a
10;;; vocabulary property asserted from the members someone happened to think of
11;;; is how SD-P3 broke `example`.
12(import (sigil core) (sigil fs) (sigil syntax) (folio doc))
14(load "test/fixtures/folio-pressure.sgl")
16(define (heads-of events)
17 (map (lambda (e) (if (pair? e) (car e) e)) events))
18(define (add-unique x seen) (if (memq x seen) seen (cons x seen)))
19(define all-heads
20 (let loop ((xs (append (heads-of (folio-events pressure-project))
21 (heads-of (folio-events pressure-note))))
22 (seen '()))
23 (if (null? xs) (reverse seen) (loop (cdr xs) (add-unique (car xs) seen)))))
25(for-each (lambda (h)
26 (display (string-append "F1A_KIND " (symbol->string h)))
27 (newline))
28 all-heads)
29(display (string-append "F1A_COVERAGE_PROBE kinds=" (number->string (length all-heads))))
30(newline)