Commit 3a0daa15 authored by pfdietz's avatar pfdietz
Browse files

Tests of nonstanardized error situations with iteration forms

parent 299423c1
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Contains: Tests of non-ANSI exceptions sutation from CLHS section 6 (Iteration)
(in-package :ba-test)
(compile-and-load "ba-aux.lsp")
;;; DO tests
(def-all-error-test do.1 'listp #'(lambda (x) `(do . ,x)))
(def-all-error-test do.2 'listp #'(lambda (x) `(do () . ,x)))
(def-all-error-test do.3 #'(lambda (x) (or (symbolp x) (listp x))) #'(lambda (x) `(do (,x))))
(def-all-error-test do.4 'listp #'(lambda (x) `(do ((a 1 (1+ a)) . ,x))))
(def-all-error-test do.5 'listp #'(lambda (x) `(do () ,x)))
(def-all-error-test do.6 'listp #'(lambda (x) `(do () (t . ,x))))
(def-all-error-test do.7 'listp #'(lambda (x) `(do () (t) . ,x)))
(def-all-error-test do.8 'listp #'(lambda (x) `(do ((a . ,x)) (t))))
(def-all-error-test do.9 'listp #'(lambda (x) `(do ((a 1 . ,x)) (t))))
(def-all-error-test do.10 'listp #'(lambda (x) `(do ((a 1 (1+ a) . ,x)) (t))))
(def-error-test do.11 (do))
;;; DO* tests
(def-all-error-test do*.1 'listp #'(lambda (x) `(do* . ,x)))
(def-all-error-test do*.2 'listp #'(lambda (x) `(do* () . ,x)))
(def-all-error-test do*.3 #'(lambda (x) (or (symbolp x) (listp x))) #'(lambda (x) `(do* (,x))))
(def-all-error-test do*.4 'listp #'(lambda (x) `(do* ((a 1 (1+ a)) . ,x))))
(def-all-error-test do*.5 'listp #'(lambda (x) `(do* () ,x)))
(def-all-error-test do*.6 'listp #'(lambda (x) `(do* () (t . ,x))))
(def-all-error-test do*.7 'listp #'(lambda (x) `(do* () (t) . ,x)))
(def-all-error-test do*.8 'listp #'(lambda (x) `(do* ((a . ,x)) (t))))
(def-all-error-test do*.9 'listp #'(lambda (x) `(do* ((a 1 . ,x)) (t))))
(def-all-error-test do*.10 'listp #'(lambda (x) `(do* ((a 1 (1+ a) . ,x)) (t))))
(def-error-test do*.11 (do*))
;;; DOTIMES tests
(def-error-test dotimes.1 (dotimes))
(def-all-error-test dotimes.2 'listp #'(lambda (x) `(dotimes . ,x)))
(def-all-error-test dotimes.3 'symbolp #'(lambda (x) `(dotimes (,x 1))))
(def-all-error-test dotimes.4 (constantly nil) #'(lambda (x) `(dotimes (,x))))
(def-all-error-test dotimes.5 'integerp #'(lambda (x) `(dotimes (i ',x))))
(def-all-error-test dotimes.6 'listp #'(lambda (x) `(dotimes (i . ,x))))
(def-all-error-test dotimes.7 'listp #'(lambda (x) `(dotimes (i 1 . ,x))))
(def-all-error-test dotimes.8 'listp #'(lambda (x) `(dotimes (i 1) . ,x)))
(def-all-error-test dotimes.9 'listp #'(lambda (x) `(dotimes (i 1 nil . ,x))))
(def-all-error-test dotimes.10 'listp #'(lambda (x) `(dotimes (i 1 nil ,x))))
;;; DOLIST tests
(def-error-test dolist.1 (dolist))
(def-all-error-test dolist.2 'listp #'(lambda (x) `(dolist . ,x)))
(def-all-error-test dolist.3 'symbolp #'(lambda (x) `(dolist (,x nil))))
(def-all-error-test dolist.4 'listp #'(lambda (x) `(dolist (e . ,x))))
(def-all-error-test dolist.5 'listp #'(lambda (x) `(dolist (e nil . ,x))))
(def-all-error-test dolist.6 'listp #'(lambda (x) `(dolist (e nil nil . ,x))))
(def-all-error-test dolist.7 'listp #'(lambda (x) `(dolist (e nil nil ,x))))
(def-all-error-test dolist.8 'listp #'(lambda (x) `(dolist (e ',x nil))))
(def-all-error-test dolist.9 'listp #'(lambda (x) `(dolist (e nil nil) . ,x)))
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Contains: Tests of non-ANSI exceptions sutation from CLHS for the LOOP macro
(in-package :ba-test)
(compile-and-load "ba-aux.lsp")
;;; LOOP tests
(def-all-error-test loop.1 'listp #'(lambda (x) `(loop . ,x)))
(def-all-error-test loop.named.1 'symbolp #'(lambda (x) `(loop named ,x return nil)))
(def-all-error-test loop.named.2 'listp #'(lambda (x) `(loop named . ,x)))
(def-error-test loop.with.1 (loop with))
(def-all-error-test loop.with.2 #'(lambda (x) (or (symbolp x) (listp x)))
#'(lambda (x) `(loop with ,x)))
(def-all-error-test loop.with.3 'listp #'(lambda (x) `(loop with . ,x)))
(def-all-error-test loop.with.4 'listp #'(lambda (x) `(loop with x . ,x)))
(def-all-error-test loop.with.5 'listp #'(lambda (x) `(loop with x = . ,x)))
(def-all-error-test loop.with.6 'listp #'(lambda (x) `(loop with x t = . ,x)))
(def-error-test loop.initially.1 (loop initially))
(def-all-error-test loop.initially.2 'listp #'(lambda (x) `(loop initially . ,x)))
(def-all-error-test loop.initially.3 'listp #'(lambda (x) `(loop initially (progn) . ,x)))
(def-error-test loop.finally.1 (loop finally))
(def-all-error-test loop.finally.2 'listp #'(lambda (x) `(loop finally . ,x)))
(def-all-error-test loop.finally.3 'listp #'(lambda (x) `(loop finally (progn) . ,x)))
;;; LOOP FOR clauses
(def-error-test loop.for.1 (loop for))
(def-all-error-test loop.for.2 'listp #'(lambda (x) `(loop for . ,x)))
(def-all-error-test loop.for.3 'symbol-or-list-p #'(lambda (x) `(loop for ,x)))
(def-all-error-test loop.for.4 'symbol-or-list-p #'(lambda (x) `(loop for ,x = nil)))
(def-error-test loop.for.5 (loop for x from))
(def-error-test loop.for.6 (loop for x upfrom))
(def-error-test loop.for.7 (loop for x downfrom))
(def-error-test loop.for.8 (loop for x upto))
(def-error-test loop.for.9 (loop for x to))
(def-error-test loop.for.10 (loop for x below))
(def-all-error-test loop.for.11 (typef '(or symbol list class))
#'(lambda (x) `(loop for e ,x = nil return e)))
(def-all-error-test loop.for.12 'listp #'(lambda (x) `(loop for x . ,x)))
(def-all-error-test loop.for.13 'listp #'(lambda (x) `(loop for x from . ,x)))
(def-all-error-test loop.for.14 'listp #'(lambda (x) `(loop for x downfrom . ,x)))
(def-all-error-test loop.for.15 'listp #'(lambda (x) `(loop for x upfrom . ,x)))
(def-all-error-test loop.for.16 'listp #'(lambda (x) `(loop for x upto . ,x)))
(def-all-error-test loop.for.17 'listp #'(lambda (x) `(loop for x to . ,x)))
(def-all-error-test loop.for.18 'listp #'(lambda (x) `(loop for x downto . ,x)))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment