]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - reports/slice-22a/profile-probes.lisp
test: prove CTM/XTM anyType equivalence (slice 22T)
[topic-maps.git] / reports / slice-22a / profile-probes.lisp
1 ;; Supplemental diagnostic evidence for obligations absent from the 397 originals.
2 ;; No Case Records are created, recorded or registered.
3 (require :asdf)
4 (assert (string= "2.5.4" (lisp-implementation-version)))
5 (setf *compile-verbose* nil *load-verbose* nil)
6 (asdf:load-asd (merge-pathnames "topic-maps.asd" (uiop:ensure-directory-pathname (uiop:getenv "TOPIC_MAPS_22A_ROOT"))))
7 (asdf:load-system "topic-maps/ctm/encoding-tests")
8 (asdf:load-system "topic-maps/xtm/tests")
9 (in-package :cl-user)
10 (defvar *profile-rows* nil)
11 (defun profile-probe (id notation text)
12 (let* ((doc "https://example.invalid/slice-22a/profile") (map nil) (actual nil) (phase "deserialize")
13 (c (handler-case
14 (progn
15 (setf map (if (eq notation :xtm)
16 (topic-maps.xtm:deserialize-octets (babel:string-to-octets text :encoding :utf-8) :document-iri doc :source-key id)
17 (topic-maps.ctm:deserialize-string text :document-iri doc :source-name id)))
18 (setf phase "canonicalize" actual (topic-maps.cxtm:canonicalize-octets map :base-locator doc)) nil)
19 (error (c) c))))
20 (push (topic-maps.test-foundation::fields "id" id "notation" (symbol-name notation) "sourceText" text
21 "documentIRI" doc "phase" phase "registered" :false
22 "condition" (if (typep c 'topic-maps.cxtm:cxtm-error)
23 (topic-maps.test-foundation::fields "class" (string (type-of c))
24 "code" (string-downcase (string (topic-maps.cxtm:error-code c))) "message" (princ-to-string c)
25 "line" nil "column" nil "cause" nil)
26 (if (eq notation :xtm) (topic-maps.xtm.tests::map-reifier-condition-data c)
27 (topic-maps.registered-original.tests::condition-data c)))
28 "model" (when map (topic-maps.template.tests::observe map))
29 "actualCXTM" (when actual (babel:octets-to-string actual :encoding :utf-8))) *profile-rows*)))
30 (defun variant-document (resource)
31 (topic-maps.xtm.tests::document (format nil "<topic id='a'><name><value>N</value><variant><scope><topicRef href='#s'/></scope>~A</variant></name></topic>" resource)))
32 (profile-probe "unknown-text-datatype" :xtm (variant-document "<resourceData datatype='http://example.com/bogus'>BOGUS</resourceData>"))
33 (profile-probe "anyType-XML" :xtm (variant-document "<resourceData datatype='http://www.w3.org/2001/XMLSchema#anyType'><f:span xmlns:f='urn:f'>X&amp;Y</f:span></resourceData>"))
34 (profile-probe "non-anyType-element-content" :xtm (variant-document "<resourceData><f:span xmlns:f='urn:f'>X</f:span></resourceData>"))
35 (profile-probe "anyURI-element-content" :xtm (variant-document "<resourceData datatype='http://www.w3.org/2001/XMLSchema#anyURI'><f:span xmlns:f='urn:f'>X</f:span></resourceData>"))
36 (profile-probe "DOCTYPE-policy" :xtm (concatenate 'string "<!DOCTYPE topicMap>" (topic-maps.xtm.tests::document "")))
37 (profile-probe "declared-Shift-JIS-ASCII" :ctm "%encoding \"Shift-JIS\" topic.")
38 (profile-probe "date-timezone-canonicalization" :ctm "topic occ: \"2000-01-01+02:00\"^^<http://www.w3.org/2001/XMLSchema#date>.")
39 (profile-probe "BCE-datetime-rollover" :ctm "topic occ: \"-0001-12-31T23:00:00-02:00\"^^<http://www.w3.org/2001/XMLSchema#dateTime>.")
40 (assert (not topic-maps.xtm.tests::*cases*))
41 (with-open-file (out (uiop:getenv "TOPIC_MAPS_22A_PROFILE_REPORT") :direction :output :if-exists :supersede :external-format :utf-8)
42 (topic-maps.test-foundation::emit-json-value (coerce (reverse *profile-rows*) 'vector) out) (terpri out))
43 (format t "PROFILE-OBSERVATIONS: 8 supplemental probes; zero Case Records and zero new original PASS~%")