;; Documentary re-execution, no case registration or ASDF test system added. (require :asdf) (load (merge-pathnames "scripts/fresh-sbcl.lisp" (uiop:ensure-directory-pathname (uiop:getenv "TOPIC_MAPS_20J_ROOT")))) (in-package :cl-user) (defun hex-bytes (bytes) (format nil "~{~2,'0X~^ ~}" (coerce bytes 'list))) (let* ((corpus topic-maps.ctm.tests::*cxtm-corpus*) (cases (topic-maps.test-foundation:corpus-cases corpus)) (open (remove-if-not (lambda (case) (eq :not-run (topic-maps.test-foundation:test-case-status case))) cases)) (before (mapcar #'topic-maps.registered-original.tests::case-state cases)) (rows nil)) (assert (= 7 (length open))) (dolist (case open) (let* ((id (topic-maps.test-foundation:test-case-id case)) (doc (topic-maps.test-foundation:test-case-document-iri case)) (source (topic-maps.test-foundation:test-case-source-pathname case)) (bytes (topic-maps.registered-original.tests::binary source)) (baseline (topic-maps.test-foundation:test-case-expected-baseline case)) (expected (when baseline (topic-maps.registered-original.tests::binary baseline)))) (multiple-value-bind (map condition) (topic-maps.registered-original.tests::captured-read (lambda () (topic-maps.ctm:deserialize-file source :document-iri doc :source-name id))) (let* ((held (when map (topic-maps.import.tests::handles map))) (state (when map (topic-maps.import.tests::state map held))) (actual (when map (topic-maps.cxtm:canonicalize-octets map :base-locator doc)))) (push (topic-maps.test-foundation::fields "id" id "documentIRI" doc "category" (string (topic-maps.test-foundation:test-case-category case)) "expectedOutcome" (string (topic-maps.test-foundation:test-case-expected-outcome case)) "sourceBytes" (length bytes) "sourceHex" (hex-bytes bytes) "sourceText" (topic-maps.ctm::decode-utf8 bytes) "baselinePath" (when baseline (namestring baseline)) "baselineBytes" (when expected (length expected)) "baselineText" (when expected (topic-maps.ctm::decode-utf8 expected)) "condition" (topic-maps.registered-original.tests::condition-data condition) "model" (when map (topic-maps.template.tests::observe map)) "actualCXTM" (when actual (topic-maps.ctm::decode-utf8 actual)) "actualBytes" (when actual (length actual)) "byteExact" (if (and actual expected (equalp actual expected)) :true :false) "canonicalizationPreservesMap" (if (and map (equal state (topic-maps.import.tests::state map held))) :true :false) "referencesCurrent" (if (and map (topic-maps.reference.tests::references-current-p map)) :true :false)) rows))))) (assert (equal before (mapcar #'topic-maps.registered-original.tests::case-state cases))) (with-open-file (out (concatenate 'string (uiop:getenv "TOPIC_MAPS_20J_OUTPUT") "/investigation.json") :direction :output :if-exists :supersede) (topic-maps.test-foundation::emit-json-value (topic-maps.test-foundation::fields "runtime" (lisp-implementation-version) "harnessStatuses" (topic-maps.test-foundation::counts-object (getf (topic-maps.test-foundation:summarize-corpus corpus) :statuses)) "harnessCaseStatesUnchanged" :true "cases" (coerce (nreverse rows) 'vector)) out) (terpri out)))