comparison tests/automated/lisp-tests.el @ 5468:a9094f28f9a9

Merge with trunk.
author Mats Lidell <matsl@xemacs.org>
date Wed, 19 Jan 2011 22:35:23 +0100
parents 89331fa1c819 ba62563ec7c7
children 0af042a0c116
comparison
equal deleted inserted replaced
5457:4ed2dedf36a1 5468:a9094f28f9a9
2786 (Check-Error args-out-of-range 2786 (Check-Error args-out-of-range
2787 (funcall function (copy-sequence string) 2787 (funcall function (copy-sequence string)
2788 (copy-sequence string) 2788 (copy-sequence string)
2789 :end1 (* 2 string-length)))))) 2789 :end1 (* 2 string-length))))))
2790 2790
2791 (let* ((list (list 1 2 3 4 5 6 7 120 'hi-there '#:everyone))
2792 (vector (map 'vector #'identity list))
2793 (bit-vector (map 'bit-vector
2794 #'(lambda (object) (if (fixnump object) 1 0)) list))
2795 (string (map 'string
2796 #'(lambda (object) (or (and (fixnump object)
2797 (int-char object))
2798 (decode-char 'ucs #x20ac))) list))
2799 (gensym (gensym)))
2800 (Assert (null (find 'not-in-it list)))
2801 (Assert (null (find 'not-in-it vector)))
2802 (Assert (null (find 'not-in-it bit-vector)))
2803 (Assert (null (find 'not-in-it string)))
2804 (loop
2805 for elt being each element in vector using (index position)
2806 do
2807 (Assert (eq elt (find elt list)))
2808 (Assert (eq (elt list position) (find elt vector))))
2809 (Assert (eq gensym (find 'not-in-it list :default gensym)))
2810 (Assert (eq gensym (find 'not-in-it vector :default gensym)))
2811 (Assert (eq gensym (find 'not-in-it bit-vector :default gensym)))
2812 (Assert (eq gensym (find 'not-in-it string :default gensym)))
2813 (Assert (eq 'hi-there (find 'hi-there list)))
2814 ;; Different uninterned symbols with the same name.
2815 (Assert (not (eq '#1=#:everyone (find '#1# list))))
2816
2817 ;; Test concatenate.
2818 (Assert (equal list (concatenate 'list vector)))
2819 (Assert (equal list (concatenate 'list (subseq vector 0 4)
2820 (subseq list 4))))
2821 (Assert (equal vector (concatenate 'vector list)))
2822 (Assert (equal vector (concatenate `(vector * ,(length vector)) list)))
2823 (Assert (equal string (concatenate `(vector character ,(length string))
2824 (append string nil))))
2825 (Assert (equal bit-vector (concatenate 'bit-vector (subseq bit-vector 0 4)
2826 (append (subseq bit-vector 4) nil))))
2827 (Assert (equal bit-vector (concatenate `(vector bit ,(length bit-vector))
2828 (subseq bit-vector 0 4)
2829 (append (subseq bit-vector 4) nil)))))
2830
2791 ;;; end of lisp-tests.el 2831 ;;; end of lisp-tests.el