]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-21h/diagnostics.lisp
Implement XTM association reification with native conformance evidence
[topic-maps.git] / reports / slice-21h / diagnostics.lisp
1 (require :asdf)
2 (assert (string= "2.5.4" (lisp-implementation-version)))
3 (setf *compile-verbose* nil *load-verbose* nil)
4 (asdf:load-asd (merge-pathnames "topic-maps.asd" (uiop:ensure-directory-pathname (uiop:getenv "TOPIC_MAPS_21H_ROOT"))))
5 (asdf:load-system "topic-maps/xtm/tests")
6 (in-package :topic-maps.xtm.tests)
7 (when (uiop:getenv "TOPIC_MAPS_21H_BASELINE")
8 (asdf:test-system "topic-maps/xtm")
9 (write-report (uiop:getenv "TOPIC_MAPS_21H_BASELINE")))
10 (let ((rows nil))
11 (dolist (p (sort (append (directory (corpus-path "xtm2/in/*.xtm")) (directory (corpus-path "xtm2/invalid/*.xtm"))) #'string< :key #'namestring))
12 (let* ((id (concatenate 'string "xtm2/" (if (search "/invalid/" (namestring p)) "invalid/" "in/") (file-namestring p)))
13 (iri (concatenate 'string "https://xtm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/" id))
14 (raw (file-bytes p)) (map nil)
15 (c (handler-case (progn (setf map (deserialize-octets raw :document-iri iri :source-key id)) nil) (error (c) c)))
16 (actual (when map (topic-maps.cxtm:canonicalize-octets map :base-locator iri)))
17 (baseline (corpus-path (concatenate 'string "xtm2/baseline/" (file-namestring p) ".cxtm"))))
18 (push (topic-maps.test-foundation::fields "id" id "documentIRI" iri "condition" (negative-condition-data c)
19 "status" (if map "deserialized" "rejected") "actualCXTM" (when actual (babel:octets-to-string actual :encoding :utf-8))
20 "byteExact" (if (and actual (probe-file baseline) (equalp actual (file-bytes baseline))) :true :false)) rows)))
21 (assert (= 124 (length rows)))
22 (with-open-file (out (uiop:getenv "TOPIC_MAPS_21H_DIAGNOSTICS") :direction :output :if-exists :supersede)
23 (topic-maps.test-foundation::emit-json-value (coerce (nreverse rows) 'vector) out) (terpri out)))
24 (assert (not (find-package :topic-maps.ctm)))