From 6a313afbb20187ef9bcbb327826f5eb0b3933787 Mon Sep 17 00:00:00 2001 From: pfdietz <pfdietz@localhost> Date: Sun, 29 May 2005 13:32:49 +0000 Subject: [PATCH] Add tests for type declarations --- ansi-tests/load-eval-and-compile.lsp | 1 + ansi-tests/type.lsp | 64 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 ansi-tests/type.lsp diff --git a/ansi-tests/load-eval-and-compile.lsp b/ansi-tests/load-eval-and-compile.lsp index f29872f5..4dbd9390 100644 --- a/ansi-tests/load-eval-and-compile.lsp +++ b/ansi-tests/load-eval-and-compile.lsp @@ -22,3 +22,4 @@ (load "macroexpand.lsp") (load "macroexpand-1.lsp") (load "declaration.lsp") +(load "type.lsp") diff --git a/ansi-tests/type.lsp b/ansi-tests/type.lsp new file mode 100644 index 00000000..84a6c8aa --- /dev/null +++ b/ansi-tests/type.lsp @@ -0,0 +1,64 @@ +;-*- 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) + + + + -- GitLab