4 |
;;;; Contains: Tests on readtables (just started, very incomplete) |
;;;; Contains: Tests on readtables (just started, very incomplete) |
5 |
|
|
6 |
(in-package :cl-test) |
(in-package :cl-test) |
|
(use-package :rt) |
|
7 |
|
|
8 |
(declaim (optimize (safety 3))) |
(declaim (optimize (safety 3))) |
9 |
|
|
10 |
(deftest readtable-valid (not (readtablep *readtable*)) nil) |
(deftest readtable-valid (not (readtablep *readtable*)) nil) |
11 |
(deftest readtablep-1 |
(deftest readtablep.1 |
12 |
(and (not (readtablep nil)) |
(and (not (readtablep nil)) |
13 |
(not (readtablep 'a)) |
(not (readtablep 'a)) |
14 |
(not (readtablep 0)) |
(not (readtablep 0)) |
35 |
) |
) |
36 |
t) |
t) |
37 |
|
|
38 |
(deftest read-symbol-1 |
(deftest read-symbol.1 |
39 |
(let ((*package* (find-package "CL-TEST"))) |
(let ((*package* (find-package "CL-TEST"))) |
40 |
(ignore-errors (read-from-string "a"))) |
(ignore-errors (read-from-string "a"))) |
41 |
a 1) |
a 1) |
42 |
|
|
43 |
(deftest read-symbol-2 |
(deftest read-symbol.2 |
44 |
(let ((*package* (find-package "CL-TEST"))) |
(let ((*package* (find-package "CL-TEST"))) |
45 |
(ignore-errors (read-from-string "|a|"))) |
(ignore-errors (read-from-string "|a|"))) |
46 |
|a| 3) |
|a| 3) |
47 |
|
|
48 |
(deftest read-symbol-3 |
(deftest read-symbol.3 |
49 |
(multiple-value-bind (s n) |
(multiple-value-bind (s n) |
50 |
(ignore-errors (read-from-string "#:abc")) |
(ignore-errors (read-from-string "#:abc")) |
51 |
(not |
(not |
55 |
(string-equal (symbol-name s) "abc")))) |
(string-equal (symbol-name s) "abc")))) |
56 |
nil) |
nil) |
57 |
|
|
58 |
(deftest read-symbol-4 |
(deftest read-symbol.4 |
59 |
(multiple-value-bind (s n) |
(multiple-value-bind (s n) |
60 |
(ignore-errors (read-from-string "#:|abc|")) |
(ignore-errors (read-from-string "#:|abc|")) |
61 |
(not |
(not |
65 |
(string= (symbol-name s) "abc")))) |
(string= (symbol-name s) "abc")))) |
66 |
nil) |
nil) |
67 |
|
|
68 |
(deftest read-symbol-5 |
(deftest read-symbol.5 |
69 |
(multiple-value-bind (s n) |
(multiple-value-bind (s n) |
70 |
(ignore-errors (read-from-string "#:||")) |
(ignore-errors (read-from-string "#:||")) |
71 |
(if (not (symbolp s)) |
(if (not (symbolp s)) |
76 |
(string= (symbol-name s) "")))))) |
(string= (symbol-name s) "")))))) |
77 |
t) |
t) |
78 |
|
|
79 |
(deftest read-symbol-6 |
(deftest read-symbol.6 |
80 |
(let ((str "cl-test::abcd0123")) |
(let ((str "cl-test::abcd0123")) |
81 |
(multiple-value-bind (s n) |
(multiple-value-bind (s n) |
82 |
(ignore-errors (read-from-string str)) |
(ignore-errors (read-from-string str)) |
89 |
"abcd0123"))))))) |
"abcd0123"))))))) |
90 |
t) |
t) |
91 |
|
|
92 |
(deftest read-symbol-7 |
(deftest read-symbol.7 |
93 |
(multiple-value-bind (s n) |
(multiple-value-bind (s n) |
94 |
(ignore-errors (read-from-string ":ABCD")) |
(ignore-errors (read-from-string ":ABCD")) |
95 |
(if (not (symbolp s)) |
(if (not (symbolp s)) |
101 |
"ABCD")))))) |
"ABCD")))))) |
102 |
t) |
t) |
103 |
|
|
104 |
(defun read-symbol-9-body (natoms maxlen) |
(defun read-symbol.9-body (natoms maxlen) |
105 |
(let* ((chars (concatenate 'string |
(let* ((chars (concatenate 'string |
106 |
"abcdefghijklmnopqrstuvwxyz" |
"abcdefghijklmnopqrstuvwxyz" |
107 |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
135 |
actual-string s2 sym :readably t) |
actual-string s2 sym :readably t) |
136 |
t))))))) |
t))))))) |
137 |
|
|
138 |
(deftest read-symbol-9 |
(deftest read-symbol.9 |
139 |
(read-symbol-9-body 1000 100) |
(read-symbol.9-body 1000 100) |
140 |
0) |
0) |
141 |
|
|
142 |
(deftest read-symbol-10 |
(deftest read-symbol.10 |
143 |
(handler-case |
(handler-case |
144 |
(not (not |
(not (not |
145 |
(equal (symbol-name |
(equal (symbol-name |