(require :asdf) (assert (string= "2.5.4" (lisp-implementation-version))) (setf *compile-verbose* nil *load-verbose* nil) (asdf:load-asd (merge-pathnames "topic-maps.asd" (uiop:ensure-directory-pathname (uiop:getenv "TOPIC_MAPS_21F_ROOT")))) (asdf:load-system "topic-maps/xtm/tests") (in-package :topic-maps.xtm.tests) (when (uiop:getenv "TOPIC_MAPS_21F_BASELINE") (asdf:test-system "topic-maps/xtm") (write-report (uiop:getenv "TOPIC_MAPS_21F_BASELINE"))) (let ((rows nil)) (dolist (p (sort (append (directory (corpus-path "xtm2/in/*.xtm")) (directory (corpus-path "xtm2/invalid/*.xtm"))) #'string< :key #'namestring)) (let* ((id (concatenate 'string "xtm2/" (if (search "/invalid/" (namestring p)) "invalid/" "in/") (file-namestring p))) (iri (concatenate 'string "https://xtm-tests.example.invalid/cd165b150176c1d6842b37be9cc9051b40d4996b/" id)) (raw (file-bytes p)) (map nil) (c (handler-case (progn (setf map (deserialize-octets raw :document-iri iri :source-key id)) nil) (error (c) c))) (actual (when map (topic-maps.cxtm:canonicalize-octets map :base-locator iri))) (baseline (corpus-path (concatenate 'string "xtm2/baseline/" (file-namestring p) ".cxtm")))) (push (topic-maps.test-foundation::fields "id" id "documentIRI" iri "condition" (negative-condition-data c) "status" (if map "deserialized" "rejected") "actualCXTM" (when actual (babel:octets-to-string actual :encoding :utf-8)) "byteExact" (if (and actual (probe-file baseline) (equalp actual (file-bytes baseline))) :true :false)) rows))) (assert (= 124 (length rows))) (with-open-file (out (uiop:getenv "TOPIC_MAPS_21F_DIAGNOSTICS") :direction :output :if-exists :supersede) (topic-maps.test-foundation::emit-json-value (coerce (nreverse rows) 'vector) out) (terpri out))) (assert (not (find-package :topic-maps.ctm)))