source: trunk/source/tests/ansi-tests/reader-aux.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Fri Jan 14 07:43:48 2005
4;;;; Contains: Auxiliary functions and macros for reader tests
5
6(in-package :cl-test)
7
8;;; Define a test using standard io syntax
9
10(defmacro def-syntax-test (name form &body expected-results)
11  `(deftest ,name
12     (with-standard-io-syntax (let ((*package* (find-package :cl-test))) ,form))
13     ,@expected-results))
14
15;;; Macros for testing specific features
16
17(defmacro def-syntax-vector-test (name form &body expected-elements)
18  `(def-syntax-test ,name
19     (let ((v (read-from-string ,form)))
20       (assert (simple-vector-p v))
21       v)
22     ,(apply #'vector expected-elements)))
23
24(defmacro def-syntax-bit-vector-test (name form &body expected-elements)
25  `(def-syntax-test ,name
26     (let ((v (read-from-string ,form)))
27       (assert (simple-bit-vector-p v))
28       v)
29     ,(make-array (length expected-elements) :element-type 'bit :initial-contents expected-elements)))
30
31(defmacro def-syntax-unintern-test (name string)
32  `(deftest ,name
33     (let ((s (read-from-string ,(concatenate 'string "#:" string))))
34       (values
35        (symbol-package s)
36        (symbol-name s)))
37     nil ,(string-upcase string)))
38
39(defmacro def-syntax-array-test (name form expected-result)
40  `(def-syntax-test ,name
41     (let ((v (read-from-string ,form)))
42       (assert (typep v 'simple-array))
43       (assert (not (array-has-fill-pointer-p v)))
44       (assert (eql (array-element-type v)
45                    (upgraded-array-element-type t)))
46       v)
47     ,(eval expected-result)))
48
49
Note: See TracBrowser for help on using the repository browser.