]> dreyeck.freedombox.rocks Git - topic-maps.git/blobdiff - tests/cxtm.lisp
feat(xtm): support anyURI resource data on name variants
[topic-maps.git] / tests / cxtm.lisp
index c77dd92d58a8e63f3c3e478251d2781a4cbc7d0e..5bed4033364b4ec8fc294f2431c6b32920c7d93b 100644 (file)
   (handler-case (progn (funcall thunk) nil) (topic-maps.cxtm:cxtm-error (c) c)))
 (defun map-state (map)
   ;; Includes object handles, all forward links, raw stored references/sets.
-  (list (copy-list (topic-maps.tmdm::%topic-map-topics map))
+  (list (topic-maps.tmdm:item-reifier map) (topic-maps.tmdm:item-identifiers map)
+        (copy-list (topic-maps.tmdm::%topic-map-topics map))
         (copy-list (topic-maps.tmdm::%topic-map-associations map))
         (loop for topic in (topic-map-topics map) collect
           (list topic (topic-maps.tmdm::%topic-forward topic) (topic-parent topic)
                 (topic-item-identifiers topic) (topic-subject-identifiers topic) (topic-subject-locators topic)
                 (loop for n in (topic-names topic) collect
-                  (list n (topic-maps.tmdm::%topic-name-forward n) (topic-name-parent n)
-                        (topic-name-type n) (topic-name-value n)))))
+                  (list n (topic-maps.tmdm:item-reifier n) (topic-maps.tmdm:item-identifiers n) (topic-maps.tmdm::%topic-name-forward n) (topic-name-parent n)
+                        (topic-name-type n) (topic-name-value n) (copy-list (topic-maps.tmdm::%topic-name-scope n))
+                        (loop for v in (topic-maps.tmdm::%topic-name-variants n) collect
+                          (list v (topic-maps.tmdm:item-reifier v) (topic-maps.tmdm:item-identifiers v) (topic-maps.tmdm::%variant-forward v) (topic-maps.tmdm::%variant-parent v)
+                                (topic-maps.tmdm::%variant-value v) (topic-maps.tmdm::%variant-datatype v)
+                                (copy-list (topic-maps.tmdm::%variant-scope v))))))
+                (loop for o in (topic-maps.tmdm:topic-occurrences topic) collect
+                  (list o (topic-maps.tmdm:item-reifier o) (topic-maps.tmdm::%occurrence-forward o) (topic-maps.tmdm:occurrence-parent o)
+                        (topic-maps.tmdm:occurrence-type o) (topic-maps.tmdm:occurrence-value o)
+                        (topic-maps.tmdm:occurrence-datatype o) (topic-maps.tmdm:occurrence-item-identifiers o)
+                        (copy-list (topic-maps.tmdm::%occurrence-scope o))))))
         (loop for a in (topic-maps.tmdm:topic-map-associations map) collect
-          (list a (topic-maps.tmdm::%association-forward a) (topic-maps.tmdm:association-type a)
-                (topic-maps.tmdm:association-parent a)
+          (list a (topic-maps.tmdm:item-reifier a) (topic-maps.tmdm:item-identifiers a) (topic-maps.tmdm::%association-forward a) (topic-maps.tmdm:association-type a)
+                (topic-maps.tmdm:association-parent a) (copy-list (topic-maps.tmdm::%association-scope a))
                 (loop for r in (topic-maps.tmdm:association-roles a) collect
-                  (list r (topic-maps.tmdm::%association-role-forward r)
+                  (list r (topic-maps.tmdm:item-reifier r) (topic-maps.tmdm:item-identifiers r) (topic-maps.tmdm::%association-role-forward r)
                         (topic-maps.tmdm:association-role-type r) (topic-maps.tmdm:association-role-player r)
                         (topic-maps.tmdm:association-role-parent r)))))))
 (defun compare-cxtm-cases ()
     (setf *last-cxtm-checks* (nreverse *checks*))
     (format t "~&CXTM-PASS: ~D checks; 24 original byte comparisons; 25 imported PASS, 248 NOT-RUN.~%" (length *last-cxtm-checks*)) t))
 
-(defun write-cxtm-report (validation-path detail-path)
+(defun write-cxtm-report (validation-path detail-path &key additional-checks
+                         (scope "Slice 4: 24 byte-equal original baselines, explicit base locator"))
   (topic-maps.test-foundation:write-validation-report *cxtm-corpus* validation-path
     :infrastructure-checks topic-maps.tests::*last-checks*
-    :implementation '(:ctm t :tmdm t :cxtm t :scope "Slice 4: CXTM for existing Topic/Name/Association/Role model; 24 byte-equal original baselines, explicit base locator"))
+    :implementation (list :ctm t :tmdm t :cxtm t :scope scope))
   (with-open-file (out detail-path :direction :output :if-exists :supersede :if-does-not-exist :create)
     (topic-maps.test-foundation::emit-json-value
      (topic-maps.test-foundation::fields
-      "kind" "cxtm-byte-equality" "passed" (length *last-cxtm-checks*) "failed" 0
-      "checks" (topic-maps.test-foundation::json-array *last-cxtm-checks*)
+      "kind" "cxtm-byte-equality" "passed" (+ (length *last-cxtm-checks*) (length additional-checks)) "failed" 0
+      "checkOutcomeInterpretation" "passed/failed count local assertions; contractCounts and case status report imported comparisons independently"
+      "contractCounts" (topic-maps.test-foundation::fields "pass" (count-if (lambda (r) (getf r :match)) *cxtm-results*)
+                                                         "fail" (count-if-not (lambda (r) (getf r :match)) *cxtm-results*))
+      "checks" (topic-maps.test-foundation::json-array (append *last-cxtm-checks* additional-checks))
       "cases" (topic-maps.test-foundation::json-array
        (loop for r in *cxtm-results* collect
          (topic-maps.test-foundation::fields "id" (getf r :id) "baseLocator" (getf r :base)