]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - tests/ctm-references.lisp
Implement CTM Include and source-preserving template import
[topic-maps.git] / tests / ctm-references.lisp
1 (defpackage #:topic-maps.reference.tests
2 (:use #:cl #:topic-maps.tmdm)
3 (:import-from #:topic-maps.ctm.tests #:check #:read-text #:api-topic #:cxtm #:map-state
4 #:ctm-condition #:binary-file #:local-topic)
5 (:import-from #:topic-maps.variant.tests #:condition-from #:handle-state)
6 (:export #:run-tests #:reference-checks #:write-reference-report))
7 (in-package #:topic-maps.reference.tests)
8
9 (defparameter *originals*
10 '(("wildcard" 1) ("wildcard-named" 1) ("wildcard-named2" 3) ("wildcard-named-merge" 1)
11 ("association-scope-embedded" 2) ("association-scope-embedded2" 3)
12 ("association-type-embedded" 1) ("association-type-embedded-merge" 2)
13 ("embedded-semicolon" 1) ("name-scope-embedded" 2) ("name-scope-embedded2" 3)
14 ("name-type-embedded" 1) ("nested-twice" 2)
15 ("occurrence-scope-embedded" 2) ("occurrence-scope-embedded2" 3) ("occurrence-type-embedded" 1)
16 ("role-player-embedded" 1) ("role-type-embedded" 1) ("subject-identifier-embedded" 1)
17 ("variant-scope-embedded" 3) ("variant-scope-embedded2" 4)))
18 (defvar *last-checks* nil)
19 (defvar *observations* nil)
20 (defun reference-checks () *last-checks*)
21 (defun by-si (map iri)
22 (find-if (lambda (topic) (member iri (topic-subject-identifiers topic) :test #'string=)) (topic-map-topics map)))
23 (defun by-label (map label)
24 (find-if (lambda (topic) (find label (topic-names topic) :key #'topic-name-value :test #'string=)) (topic-map-topics map)))
25 (defun references-current-p (map)
26 (let ((topics (topic-map-topics map)))
27 (labels ((current (topic) (and (eq topic (canonical-topic topic)) (eq map (topic-parent topic))
28 (member topic topics :test #'eq))))
29 (and (every #'current topics)
30 (topic-maps.ctm.tests::scope-ref-invariants map)
31 (topic-maps.variant.tests::variant-invariants map)
32 (every (lambda (topic)
33 (and (every (lambda (n) (and (eq n (canonical-topic-name n))
34 (eq topic (topic-maps.tmdm::%topic-name-parent n))
35 (current (topic-maps.tmdm::%topic-name-type n)))) (topic-names topic))
36 (every (lambda (o) (and (eq o (canonical-occurrence o))
37 (eq topic (topic-maps.tmdm::%occurrence-parent o))
38 (current (topic-maps.tmdm::%occurrence-type o)))) (topic-occurrences topic)))) topics)
39 (every (lambda (a)
40 (and (eq a (canonical-association a)) (eq map (association-parent a))
41 (current (topic-maps.tmdm::%association-type a))
42 (every (lambda (r) (and (eq r (canonical-association-role r))
43 (eq a (topic-maps.tmdm::%association-role-parent r))
44 (current (topic-maps.tmdm::%association-role-type r))
45 (current (topic-maps.tmdm::%association-role-player r)))) (association-roles a))))
46 (topic-map-associations map))))))
47
48 (defun original-cases ()
49 (setf *observations* nil)
50 (dolist (fixture *originals*)
51 (let* ((id (format nil "ctm/in/~A.ctm" (first fixture)))
52 (case (first (topic-maps.test-foundation:select-cases topic-maps.ctm.tests::*cxtm-corpus* :id id)))
53 (doc (topic-maps.test-foundation:test-case-document-iri case)))
54 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-file
55 (topic-maps.test-foundation:test-case-source-pathname case) :document-iri doc :source-name id)
56 (let* ((before (map-state map))
57 (actual (topic-maps.cxtm:canonicalize-octets map :base-locator doc))
58 (expected (binary-file (topic-maps.test-foundation:test-case-expected-baseline case))))
59 (check (concatenate 'string id ":normative-counter") (= counter (second fixture)))
60 (check (concatenate 'string id ":actual-and-stored-reference-identity") (references-current-p map))
61 (check (concatenate 'string id ":all-topics-identified")
62 (every (lambda (topic) (or (topic-item-identifiers topic) (topic-subject-identifiers topic)
63 (topic-subject-locators topic))) (topic-map-topics map)))
64 (check (concatenate 'string id ":byte-exact-cxtm") (equalp actual expected))
65 (check (concatenate 'string id ":deterministic-and-mutation-free")
66 (and (equalp actual (topic-maps.cxtm:canonicalize-octets map :base-locator doc)) (equal before (map-state map))))
67 (topic-maps.test-foundation:record-result case :cxtm-match)
68 (setf (topic-maps.test-foundation:test-case-clauses case)
69 '("CTM 3.2" "CTM 3.3.6-3.3.9" "CTM 3.9-3.13" "TMDM 5.1" "TMDM 5.3-5.8"
70 "TMDM 6.1-6.7" "CXTM 3.4-3.21" "CXTM 4.3-4.11"))
71 (setf topic-maps.ctm.tests::*cxtm-results*
72 (append topic-maps.ctm.tests::*cxtm-results*
73 (list (list :id id :base doc :actual (cxtm map doc)
74 :expected (uiop:read-file-string (topic-maps.test-foundation:test-case-expected-baseline case)
75 :external-format :utf-8)
76 :match t :bytes (length actual)))))
77 (push (topic-maps.test-foundation::fields "id" id "documentIRI" doc "wildcardIRI" doc "finalCounter" counter
78 "ctmSource" (uiop:read-file-string (topic-maps.test-foundation:test-case-source-pathname case) :external-format :utf-8)
79 "scopedObjects" (topic-maps.ctm.tests::scope-observation map)
80 "nameObjects" (topic-maps.variant.tests::observe-map map)) *observations*)
81 (format t "~&REFERENCE-CXTM ~A: PASS (~D bytes), counter ~D~%" id (length actual) counter)))))
82 (let* ((id "ctm/invalid/embedded-topic-global-scope.ctm")
83 (case (first (topic-maps.test-foundation:select-cases topic-maps.ctm.tests::*cxtm-corpus* :id id)))
84 (text (uiop:read-file-string (topic-maps.test-foundation:test-case-source-pathname case)))
85 (e (condition-from (lambda () (topic-maps.ctm:deserialize-file
86 (topic-maps.test-foundation:test-case-source-pathname case)
87 :document-iri (topic-maps.test-foundation:test-case-document-iri case) :source-name id)))))
88 (check "embedded-global:original-specific-rejection-and-position"
89 (and (eq (type-of e) 'topic-maps.ctm:ctm-rejection)
90 (eq :embedded-topic-at-top-level (topic-maps.ctm:error-code e))
91 (= (length text) (topic-maps.ctm:error-position e))
92 (= 1 (topic-maps.ctm:error-line e)) (= (1+ (length text)) (topic-maps.ctm:error-column e))))
93 (topic-maps.test-foundation:record-result case :ctm-rejection :diagnostics (list (princ-to-string e)))
94 (setf (topic-maps.test-foundation:test-case-clauses case) '("CTM 3.3.7" "CTM 3.5" "CTM 3.8")))
95 (setf *observations* (nreverse *observations*)))
96
97 (defun wildcard-tests ()
98 (let ((doc "https://example.invalid/doc.ctm") (wild "https://identity.example.invalid/wild.ctm"))
99 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-string
100 "?. ?foo. local - [-\"Type\"]: \"N\" @?foo; t: <relative> @?. ?foo."
101 :document-iri doc :wildcard-iri wild :wildcard-counter 10)
102 (let* ((topics (topic-map-topics map)) (local (local-topic map "local" doc))
103 (name (first (topic-names local))) (o (first (topic-occurrences local)))
104 (foo (find (concatenate 'string wild "#$__12.foo") topics :test #'string= :key (lambda (x) (first (topic-item-identifiers x))))))
105 (check "wildcards:document-and-wildcard-iri-are-independent"
106 (and (= 14 counter) (equal (list (concatenate 'string wild "#$__13")) (topic-item-identifiers (topic-name-type name)))
107 (eq foo (first (topic-name-scope name)))
108 (equal (list (concatenate 'string wild "#$__14")) (topic-item-identifiers (first (occurrence-scope o))))
109 (string= "https://example.invalid/relative" (occurrence-value o))
110 (eq (local-topic map "t" doc) (occurrence-type o)) (references-current-p map)))
111 (check "wildcards:no-extra-generated-subject-identifiers"
112 (every (lambda (topic) (if (member (default-name-type-identifier) (topic-subject-identifiers topic) :test #'string=)
113 t (and (null (topic-subject-identifiers topic)) (null (topic-subject-locators topic))))) topics))))
114 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-string "?X. ?x. ?Ω. ?Ω. ?. ?. X."
115 :document-iri doc)
116 (check "wildcards:case-unicode-anonymous-uniqueness-and-local-namespace"
117 (and (= 5 counter) (= 6 (length (topic-map-topics map)))
118 (equal (mapcar (lambda (x) (list (concatenate 'string doc x)))
119 '("#$__1.X" "#$__2.x" "#$__3.Ω" "#$__4" "#$__5" "#X"))
120 (mapcar #'topic-item-identifiers (topic-map-topics map))))))
121 (let ((initial (expt 10 100)))
122 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-string "?." :document-iri doc :wildcard-counter initial)
123 (check "wildcards:arbitrary-precision-counter"
124 (and (= (1+ initial) counter)
125 (equal (list (format nil "~A#$__~D" doc (1+ initial))) (topic-item-identifiers (first (topic-map-topics map))))))))
126 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-string "" :document-iri doc :wildcard-counter 42)
127 (check "wildcards:empty-document-retains-counter" (and (= 42 counter) (null (topic-map-topics map)))))
128 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-file
129 (asdf:system-relative-pathname "topic-maps" "vendor/cxtm/ctm/in/wildcard-named2.ctm")
130 :document-iri doc :wildcard-iri wild :wildcard-counter 100)
131 (check "wildcards:file-api-forwards-environment-and-final-counter"
132 (and (= 103 counter) (equal (list (concatenate 'string wild "#$__101.foo"))
133 (topic-item-identifiers (first (topic-map-topics map))))))))
134 (let* ((text "?foo <urn:shared>. alias <urn:shared>. a - ?foo:\"N\".")
135 (map (read-text text)) (alias (local-topic map "alias")) (name (first (topic-names (local-topic map "a")))))
136 (check "wildcards:named-locator-resolves-after-topic-replacement" (eq alias (topic-name-type name)))
137 (check "wildcards:identity-properties-preserved-after-merge"
138 (and (= 2 (length (topic-item-identifiers alias))) (equal '("urn:shared") (topic-subject-identifiers alias))
139 (references-current-p map))))
140 (let ((first (read-text "?foo.")) (second (read-text "?foo.")))
141 (check "wildcards:environment-is-per-deserialization-not-global"
142 (and (not (eq (first (topic-map-topics first)) (first (topic-map-topics second))))
143 (equal (topic-item-identifiers (first (topic-map-topics first)))
144 (topic-item-identifiers (first (topic-map-topics second)))))))
145 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-string
146 "?owner - ?type:\"N\"@?scope(\"V\"@?extra); ?occ: \"O\"@?scope. ?assoc(?role: ?owner)@?scope"
147 :document-iri "https://example.invalid/wild-positions.ctm")
148 (labels ((w (number name)
149 (find-if (lambda (topic) (member (format nil "https://example.invalid/wild-positions.ctm#$__~D.~A" number name)
150 (topic-item-identifiers topic) :test #'string=)) (topic-map-topics map))))
151 (let* ((owner (w 1 "owner")) (n (first (topic-names owner))) (o (first (topic-occurrences owner)))
152 (a (first (topic-map-associations map))) (r (first (association-roles a))) (theme (w 3 "scope")))
153 (check "wildcards:all-type-player-scope-positions-share-one-environment"
154 (and (= 7 counter) (= 7 (length (topic-map-topics map)))
155 (every #'identity (list owner (w 2 "type") theme (w 4 "extra") (w 5 "occ") (w 6 "assoc") (w 7 "role")))
156 (eq owner (topic-name-parent n)) (eq (w 2 "type") (topic-name-type n))
157 (eq (w 5 "occ") (occurrence-type o)) (eq (w 6 "assoc") (association-type a))
158 (eq (w 7 "role") (association-role-type r)) (eq owner (association-role-player r))
159 (every (lambda (scope) (equal (list theme) scope))
160 (list (topic-name-scope n) (occurrence-scope o) (association-scope a)))
161 (member theme (variant-scope (first (topic-name-variants n))))
162 (member (w 4 "extra") (variant-scope (first (topic-name-variants n))))
163 (references-current-p map))))))
164 (dolist (fixture '((:wildcard-iri nil :invalid-wildcard-iri)
165 (:wildcard-iri "relative" :invalid-wildcard-iri)
166 (:wildcard-iri "https://example.invalid/doc#fragment" :invalid-wildcard-iri)
167 (:wildcard-counter -1 :invalid-wildcard-counter)
168 (:wildcard-counter 1.0 :invalid-wildcard-counter)
169 (:wildcard-counter nil :invalid-wildcard-counter)))
170 (dolist (file-p '(nil t))
171 (let ((e (condition-from (lambda () (apply (if file-p #'topic-maps.ctm:deserialize-file #'topic-maps.ctm:deserialize-string)
172 (if file-p "this-file-must-not-be-opened.invalid" "?.")
173 :document-iri "https://example.invalid/doc.ctm" (subseq fixture 0 2))))))
174 (check (format nil "wildcards:environment:~S:file=~A:before-reading" fixture file-p)
175 (and (eq (type-of e) 'topic-maps.ctm:ctm-rejection)
176 (eq (third fixture) (topic-maps.ctm:error-code e)) (= 0 (topic-maps.ctm:error-position e)))))))
177 (check "wildcards:valid-environment-does-not-hide-file-errors"
178 (typep (condition-from (lambda () (topic-maps.ctm:deserialize-file "this-file-must-not-be-opened.invalid"
179 :document-iri "https://example.invalid/doc.ctm"))) 'file-error)))
180
181 (defun embedded-tests ()
182 (let* ((map (read-text "[<urn:at>; - \"AT\"]([<urn:rt>; - \"RT\"]: [<urn:p>; - \"P\"]) @[<urn:s>; - \"S\"] owner - [<urn:nt>; - \"NT\"]:\"N\"@[<urn:s>; - \"S\"] (\"V\"@[<urn:v>; - \"V\"]); [<urn:ot>; - \"OT\"]: 1@[<urn:s>; - \"S\"]."))
183 (a (first (topic-map-associations map))) (r (first (association-roles a)))
184 (owner (local-topic map "owner")) (n (first (topic-names owner)))
185 (v (first (topic-name-variants n))) (o (first (topic-occurrences owner))) (theme (by-si map "urn:s")))
186 (check "embedded:all-reference-positions-use-actual-topics"
187 (and (eq (by-si map "urn:at") (association-type a)) (eq (by-si map "urn:rt") (association-role-type r))
188 (eq (by-si map "urn:p") (association-role-player r)) (eq (by-si map "urn:nt") (topic-name-type n))
189 (eq (by-si map "urn:ot") (occurrence-type o))
190 (every (lambda (scope) (equal (list theme) scope))
191 (list (association-scope a) (topic-name-scope n) (occurrence-scope o)))
192 (member theme (variant-scope v) :test #'eq) (member (by-si map "urn:v") (variant-scope v) :test #'eq)
193 (eq n (variant-parent v)) (eq owner (occurrence-parent o)) (references-current-p map)))
194 (check "embedded:identities-union-after-repeated-subject-identifier"
195 (and (= 3 (length (topic-item-identifiers theme))) (= 9 (length (topic-map-topics map)))))
196 (let ((before (map-state map)))
197 (check "embedded:canonicalization-leaves-recursive-model-unchanged"
198 (and (string= (cxtm map) (cxtm map)) (equal before (map-state map))))))
199 (dolist (literal '("1" "1.0" "2000-01-01" "2000-01-01T00:00:00Z"))
200 (let* ((map (read-text (format nil "a - [t: ~A]:\"N\"." literal)))
201 (n (first (topic-names (local-topic map "a"))))
202 (o (first (topic-occurrences (topic-name-type n)))))
203 (check (concatenate 'string "embedded:numeric-token-stops-before-close:" literal)
204 (and (string= literal (occurrence-value o)) (references-current-p map)))))
205 (dolist (depth '(1 2 5 20 40))
206 (let ((text "[-\"leaf\"]"))
207 (dotimes (i (1- depth)) (setf text (format nil "[-~A:\"level\"]" text)))
208 (multiple-value-bind (map counter) (topic-maps.ctm:deserialize-string (format nil "a - ~A:\"Root\"." text)
209 :document-iri "https://example.invalid/deep.ctm")
210 (check (format nil "embedded:recursive-depth:~D:preorder-counter-and-identities" depth)
211 (and (= depth counter) (= (+ depth 2) (length (topic-map-topics map))) (references-current-p map)))
212 (let ((topic (local-topic map "a" "https://example.invalid/deep.ctm")))
213 (dotimes (i depth)
214 (setf topic (topic-name-type (first (topic-names topic))))
215 (check (format nil "embedded:depth:~D:type-chain:~D" depth i)
216 (equal (list (format nil "https://example.invalid/deep.ctm#$__~D" (1+ i)))
217 (topic-item-identifiers topic)))))))))
218
219 (defun merge-tests ()
220 (let* ((map (read-text "one - [<urn:type1>]:\"N\"@?a(\"V\"@?b). two - [<urn:type2>]:\"N\"@?a(\"V\"@?b). rel(role: one)"))
221 (one (local-topic map "one")) (two (local-topic map "two"))
222 (n1 (first (topic-names one))) (n2 (first (topic-names two)))
223 (v1 (first (topic-name-variants n1))) (v2 (first (topic-name-variants n2)))
224 (role (first (association-roles (first (topic-map-associations map))))))
225 (merge-topics one two) (merge-topics (by-si map "urn:type1") (by-si map "urn:type2"))
226 (check "references:merge-updates-parent-type-player-and-retained-name-variant-handles"
227 (and (eq (canonical-topic-name n1) (canonical-topic-name n2)) (eq (canonical-variant v1) (canonical-variant v2))
228 (eq (canonical-topic one) (topic-name-parent n1)) (eq (canonical-topic one) (association-role-player role))
229 (eq (canonical-topic-name n1) (variant-parent v1)) (references-current-p map)))
230 (let ((before (map-state map)) (old (handle-state (list v1 v2)))
231 (forward (list (topic-maps.tmdm::%topic-forward one) (topic-maps.tmdm::%topic-name-forward n1))))
232 (check "references:cxTM-does-not-change-retained-forward-links"
233 (and (string= (cxtm map) (cxtm map)) (equal before (map-state map))
234 (equal old (handle-state (list v1 v2)))
235 (equal forward (list (topic-maps.tmdm::%topic-forward one) (topic-maps.tmdm::%topic-name-forward n1)))))))
236 (let* ((map (read-text "owner - \"N\"@[-\"A\"],[-\"B\"] (\"V\"@[-\"X\"])."))
237 (n (first (topic-names (local-topic map "owner")))) (v (first (topic-name-variants n)))
238 (a (by-label map "A")) (b (by-label map "B")) (x (by-label map "X")))
239 (merge-topics a b)
240 (check "references:embedded-theme-merge-reduces-scope-cardinality"
241 (and (= 1 (length (topic-name-scope n))) (= 2 (length (variant-scope v))) (references-current-p map)))
242 (let ((before (map-state map)) (e (condition-from (lambda () (merge-topics a x)))))
243 (check "references:embedded-theme-collapse-remains-atomic"
244 (and (typep e 'variant-error) (eq :variant-scope-collapse (variant-error-code e)) (equal before (map-state map)))))))
245
246 (defun diagnostic-tests ()
247 (dolist (fixture '(("a - []:\"N\"." :expected-topic-tail)
248 ("a - [-\"T\".:\"N\"." :missing-embedded-close)
249 ("a - [-\"T\"" :missing-embedded-close)
250 ("[-\"T\"]." :embedded-topic-at-top-level)
251 ("a t:[-\"bad\"]." :expected-occurrence-value)
252 ("a t:\"V\"^^[-\"bad\"]." :expected-datatype-iri)
253 ("a - [?]:\"N\"." :expected-occurrence-type-separator)
254 ("a - [;]:\"N\"." :unexpected-token)
255 ("a([-\"r\"]:p)" :role-separator-whitespace)
256 ("a - \"N\"@[<urn:s>](\"V\"@[<urn:s>])." :invalid-variant-scope)
257 ("a - \"N\"@[<urn:p>](\"V\"@[<urn:x>]). t - \"T\"@[<urn:p>;<urn:x>]." :variant-scope-collapse)))
258 (let ((e (ctm-condition (first fixture))))
259 (check (format nil "reference-diagnostic:~A" (first fixture))
260 (and (eq (type-of e) 'topic-maps.ctm:ctm-rejection) (eq (second fixture) (topic-maps.ctm:error-code e))
261 (<= 0 (topic-maps.ctm:error-position e) (length (first fixture)))
262 (= 1 (topic-maps.ctm:error-line e)) (= (1+ (topic-maps.ctm:error-position e)) (topic-maps.ctm:error-column e))))))
263 (let ((e (ctm-condition (format nil "a - [~%]:\"N\"."))))
264 (check "reference-diagnostic:empty-embedded-exact-line-column"
265 (and (eq :expected-topic-tail (topic-maps.ctm:error-code e)) (= 2 (topic-maps.ctm:error-line e))
266 (= 1 (topic-maps.ctm:error-column e)) (= 6 (topic-maps.ctm:error-position e)))))
267 (dolist (text '("a([-\"r\"] :p)" "a([-\"r\"]: p)" "a([-\"r\"]#(gap)#:[-\"p\"])"))
268 (check (concatenate 'string "embedded:role-layout-preserved:" text) (references-current-p (read-text text))))
269 (dolist (text '("a - [-\"N\" ~r]:\"X\"." "a - \"N\"@[-\"T\"] ~r."
270 "def tpl() a. end" "%include <file.ctm>" "%mergemap <file.ctm> <urn:ctm>"))
271 (check (if (search "%include" text) "references:Include-requires-explicit-resolver"
272 (concatenate 'string "references:feature-boundary:" text))
273 (cond ((search "def " text) (null (topic-map-topics (read-text text))))
274 ((find #\~ text) (null (ctm-condition text)))
275 ((search "%include" text)
276 (let ((c (ctm-condition text)))
277 (and (typep c 'topic-maps.ctm:ctm-unsupported)
278 (eq :resource-resolver-required (topic-maps.ctm:error-code c)))))
279 ((search "%mergemap" text)
280 (let ((c (ctm-condition text)))
281 (and (typep c 'topic-maps.ctm:ctm-rejection)
282 (eq :unknown-mergemap-notation (topic-maps.ctm:error-code c)))))
283 (t (typep (ctm-condition text) 'topic-maps.ctm:ctm-unsupported)))))
284 (check "references:feature-boundary:a(r: b, s: c, t: d)"
285 (references-current-p (read-text "a(r: b, s: c, t: d)")))
286 (dolist (text '("a isa b." "a ako b."))
287 (check (concatenate 'string "references:feature-boundary:" text)
288 (references-current-p (read-text text))))
289 (check "references:template-dependent-negative-not-promoted"
290 (eq :not-run (topic-maps.test-foundation:test-case-status
291 (first (topic-maps.test-foundation:select-cases topic-maps.ctm.tests::*cxtm-corpus*
292 :id "ctm/invalid/embedded-topic-template.ctm"))))))
293
294 (defun run-tests ()
295 (topic-maps.variant.tests:run-tests)
296 (let ((topic-maps.ctm.tests::*checks* nil))
297 (original-cases) (wildcard-tests) (embedded-tests) (merge-tests) (diagnostic-tests)
298 (check "references:only-22-original-contract-transitions"
299 (equal '(:pass 93 :fail 2 :unsupported 0 :not-run 178)
300 (getf (topic-maps.test-foundation:summarize-corpus topic-maps.ctm.tests::*cxtm-corpus*) :statuses)))
301 (setf *last-checks* (nreverse topic-maps.ctm.tests::*checks*))
302 (format t "~&REFERENCES-PASS: ~D checks; 21 original byte-exact comparisons and 1 specific rejection; 93 PASS, 2 known FAIL, 178 NOT-RUN.~%"
303 (length *last-checks*)) t))
304 (defun write-reference-report (path)
305 (with-open-file (out path :direction :output :if-exists :supersede :if-does-not-exist :create)
306 (topic-maps.test-foundation::emit-json-value
307 (topic-maps.test-foundation::fields "kind" "topic-reference-evidence" "passed" (length *last-checks*) "failed" 0
308 "checks" (topic-maps.test-foundation::json-array *last-checks*)
309 "cases" (topic-maps.test-foundation::json-array *observations*)) out)
310 (terpri out)))