(require :asdf) (assert (string= "2.5.4" (lisp-implementation-version))) (setf *compile-verbose* nil *load-verbose* nil) (asdf:load-asd #P"/Users/rgb/workspace/topic-maps/topic-maps.asd") (asdf:load-system "topic-maps/xtm/tests") (in-package :topic-maps.xtm.tests) (defun preflight-state (map) (list (variant-state map) (item-reifier map) (loop for topic in (topic-map-topics map) collect (list topic (canonical-topic topic) (topic-reified topic) (topic-maps.tmdm::%topic-forward topic))))) (let* ((map (make-topic-map)) (r (intern-topic map :item-identifier "urn:reifier")) (owner (intern-topic map :subject-identifier "urn:owner")) (name (add-default-name owner "N"))) (assert (eq map (set-item-reifier map r))) (assert (eq r (item-reifier map))) (assert (eq map (topic-reified r))) (assert (eq map (set-item-reifier map r))) (let* ((before (preflight-state map)) (c (condition-from (lambda () (set-item-reifier name r))))) (assert (eq 'reification-error (type-of c))) (assert (eq :reifier-conflict (reification-error-code c))) (assert (equal before (preflight-state map))) (format t "MAP-REIFIER-API-CONDITION: ~A ~A; rejected assignment atomic~%" (type-of c) (reification-error-code c))) (add-item-identifier name "urn:name") (let* ((before (preflight-state map)) (c (condition-from (lambda () (intern-topic map :item-identifier "urn:name"))))) (assert (typep c 'item-identifier-error)) (assert (eq :duplicate-item-identifier (item-identifier-error-code c))) (assert (equal before (preflight-state map))) (format t "MAP-REIFIER-API-CONDITION: ~A ~A; rejected creation atomic~%" (type-of c) (item-identifier-error-code c))) (let ((other (intern-topic map :item-identifier "urn:other"))) (add-topic-identifier other :item-identifier "urn:reifier") (assert (eq (canonical-topic r) (canonical-topic other))) (assert (eq (canonical-topic r) (item-reifier map))) (assert (eq map (topic-reified other)))) (assert (topic-maps.tmdm::validate-map-reification map))) (let* ((map (make-topic-map)) (si (intern-topic map :subject-identifier "urn:si-only"))) (assert (null (item-identifiers si))) (assert (eq si (intern-topic map :item-identifier "urn:si-only"))) (assert (equal '("urn:si-only") (item-identifiers si)))) (format t "MAP-REIFIER-API-PREFLIGHT-PASS: native inverse, II creation, canonical merging and conflict atomicity~%")