Commit 6a313afb authored by pfdietz's avatar pfdietz

Add tests for type declarations

parent ac007919
......@@ -22,3 +22,4 @@
(load "macroexpand.lsp")
(load "macroexpand-1.lsp")
(load "declaration.lsp")
(load "type.lsp")
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun May 29 08:25:46 2005
;;;; Contains: Tests of TYPE declarations
(in-package :cl-test)
;;; Also of implicit type declarations
(deftest type.1
(let ((x 1))
(declare (type (integer 0 1) x))
(values
x
(setq x 0)
(1+ x)))
1 0 1)
(deftest type.2
(let ((x 1))
(declare (type (integer -1 1) x))
(locally (declare (type (integer 0 2) x))
(values
x
(setq x 0)
(1+ x))))
1 0 1)
(deftest type.3
(loop for x in *mini-universe*
for tp = (type-of x)
for form = `(let ((y ',x))
(declare (type ,tp y))
y)
for val = (eval form)
unless (eql val x)
collect (list x tp form val))
nil)
(deftest type.4
(loop for x in *mini-universe*
for tp = (type-of x)
for form = `(let ((y ',x))
(declare (,tp y))
y)
for val = (eval form)
unless (eql val x)
collect (list x tp form val))
nil)
(deftest type.5
(loop for x in *mini-universe*
for class = (class-of x)
for form = `(let ((y ',x))
(declare (,class y))
y)
for val = (eval form)
unless (eql val x)
collect (list x class form val))
nil)
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