Mercurial > hg > xemacs-beta
comparison tests/automated/base64-tests.el @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 9d177e8d4150 |
children | 189fb67ca31a |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
172 ?8 ?9 ?+ ?/ ?=)) | 172 ?8 ?9 ?+ ?/ ?=)) |
173 | 173 |
174 (defconst bt-nonbase64-chars (set-difference (mapcar #'identity bt-allchars) | 174 (defconst bt-nonbase64-chars (set-difference (mapcar #'identity bt-allchars) |
175 bt-base64-chars)) | 175 bt-base64-chars)) |
176 | 176 |
177 (when t | 177 (loop for (raw encoded) in bt-test-strings do |
178 ;; This code crashes some versions of XEmacs 21.2! This requires | 178 (unless (equal raw "") |
179 ;; further investigation. I (hniksic) am running Linux, and for me, | 179 (let* ((middlepos (/ (1+ (length encoded)) 2)) |
180 ;; XEmacs used to crash in Fmapconcat()->mapcar1(), after a GC that | 180 (left (substring encoded 0 middlepos)) |
181 ;; thrashes the stack. Raymond Toy reported a similar crash under | 181 (right (substring encoded middlepos))) |
182 ;; Solaris. I can no longer repeat the bug, so I cannot fix it now. | 182 ;; Whitespace at the beginning, end, and middle. |
183 (loop for (raw encoded) in bt-test-strings do | 183 (let ((mangled (concat bt-nonbase64-chars left bt-nonbase64-chars right |
184 (unless (equal raw "") | 184 bt-nonbase64-chars))) |
185 (let* ((middlepos (/ (1+ (length encoded)) 2)) | 185 (Assert (equal (bt-base64-decode-string mangled) raw))) |
186 (left (substring encoded 0 middlepos)) | 186 |
187 (right (substring encoded middlepos))) | 187 ;; Whitespace between every char. |
188 ;; Whitespace at the beginning, end, and middle. | 188 (let ((mangled (concat bt-nonbase64-chars |
189 (let ((mangled (concat bt-nonbase64-chars left bt-nonbase64-chars right | 189 ;; ENCODED with bt-nonbase64-chars |
190 bt-nonbase64-chars))) | 190 ;; between every character. |
191 (Assert (equal (bt-base64-decode-string mangled) raw))) | 191 (mapconcat #'char-to-string encoded |
192 | 192 (apply #'string bt-nonbase64-chars)) |
193 ;; Whitespace between every char. | 193 bt-nonbase64-chars))) |
194 (let ((mangled (concat bt-nonbase64-chars | 194 (Assert (equal (bt-base64-decode-string mangled) raw)))))) |
195 ;; ENCODED with bt-nonbase64-chars | |
196 ;; between every character. | |
197 (mapconcat #'char-to-string encoded | |
198 (apply #'string bt-nonbase64-chars)) | |
199 bt-nonbase64-chars))) | |
200 (Assert (equal (bt-base64-decode-string mangled) raw)))))) | |
201 ) | |
202 | 195 |
203 ;;----------------------------------------------------- | 196 ;;----------------------------------------------------- |
204 ;; Mixed... | 197 ;; Mixed... |
205 ;;----------------------------------------------------- | 198 ;;----------------------------------------------------- |
206 | 199 |