File: extended-loop.lisp

package info (click to toggle)
cmucl 21d-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 45,328 kB
  • sloc: lisp: 378,758; ansic: 30,673; asm: 2,977; sh: 1,417; makefile: 357; csh: 31
file content (30 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(defpackage :extended-loop-tests
  (:use :cl :lisp-unit))

(in-package "EXTENDED-LOOP-TESTS")

(define-test loop-codepoint
    (:tag :extended-loop)
  (let ((codepoints (mapcar #'(lambda (c)
				(if (characterp c)
				    (char-code c)
				    c))
			    '(#\a #\b #\greek_capital_letter_gamma
			      ;; This is a random code point that
			      ;; requires a surrogate pair in our
			      ;; UTF-16 string represntation.
			      65536
			      #\c))))
    (assert-equal codepoints
		  (loop for c being the codepoints of (lisp::codepoints-string codepoints)
			collect c))))

(define-test loop-glyph-string
    (:tag :extended-loop)
  (let* ((s (string #\Latin_Small_Letter_A_With_Diaeresis_and_macron))
	 (d (lisp::string-to-nfkd s)))
    (assert-equal (list s)
		  (loop for g being the glyphs of s collect g))
    (assert-equal (list d)
		  (loop for g being the glyphs of d collect g))))