Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
ansi-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Karsten Poeck
ansi-test
Commits
4fc90271
Commit
4fc90271
authored
Oct 19, 2002
by
pfdietz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for CCASE (except for continuation tests).
parent
7bf677da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
162 additions
and
0 deletions
+162
-0
ansi-tests/ccase.lsp
ansi-tests/ccase.lsp
+161
-0
ansi-tests/gclload2.lsp
ansi-tests/gclload2.lsp
+1
-0
No files found.
ansi-tests/ccase.lsp
0 → 100644
View file @
4fc90271
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Fri Oct 18 21:06:45 2002
;;;; Contains: Tests of CCASE
(in-package :cl-test)
(deftest ccase.1
(let ((x 'b))
(ccase x (a 1) (b 2) (c 3)))
2)
(deftest ccase.2
(let ((x 1))
(classify-error (ccase x)))
type-error)
(deftest ccase.3
(let ((x 1))
(classify-error (ccase x (a 1) (b 2) (c 3))))
type-error)
;;; It is legal to use T or OTHERWISE as key designators
;;; in CCASE forms. They have no special meaning here.
(deftest ccase.4
(let ((x 1))
(classify-error (ccase x (t nil))))
type-error)
(deftest ccase.5
(let ((x 1))
(classify-error (ccase x (otherwise nil))))
type-error)
(deftest ccase.6
(let ((x 'b))
(ccase x ((a z) 1) ((y b w) 2) ((b c) 3)))
2)
(deftest ccase.7
(let ((x 'z))
(ccase x
((a b c) 1)
((d e) 2)
((f z g) 3)))
3)
(deftest ccase.8
(let ((x (1+ most-positive-fixnum)))
(ccase x (#.(1+ most-positive-fixnum) 'a)))
a)
(deftest ccase.9
(let (x)
(classify-error (ccase x (nil 'a))))
type-error)
(deftest ccase.10
(let (x)
(ccase x ((nil) 'a)))
a)
(deftest ccase.11
(let ((x 'a))
(ccase x (b 0) (a (values 1 2 3)) (c nil)))
1 2 3)
(deftest ccase.12
(let ((x t))
(classify-error (ccase x (a 10))))
type-error)
(deftest ccase.13
(let ((x t))
(ccase x ((t) 10) (t 20)))
10)
(deftest ccase.14
(let ((x (list 'a 'b)))
(eval `(let ((y (quote ,x))) (ccase y ((,x) 1) (a 2)))))
1)
(deftest ccase.15
(let ((x 'otherwise))
(classify-error (ccase x ((t) 10))))
type-error)
(deftest ccase.16
(let ((x t))
(classify-error (ccase x ((otherwise) 10))))
type-error)
(deftest ccase.17
(let ((x 'a))
(classify-error (ccase x (b 0) (c 1) (otherwise 2))))
type-error)
(deftest ccase.19
(let ((x 'a))
(classify-error (ccase x (b 0) (c 1) ((t) 2))))
type-error)
(deftest ccase.20
(let ((x #\a))
(ccase x
((#\b #\c) 10)
((#\d #\e #\A) 20)
(() 30)
((#\z #\a #\y) 40)))
40)
(deftest ccase.21 (let ((x 1)) (ccase x (1 (values)) (2 'a))))
(deftest ccase.23 (let ((x 1)) (ccase x (1 (values 'a 'b 'c))))
a b c)
;;; Show that the key expression is evaluated only once.
(deftest ccase.25
(let ((a (vector 'a 'b 'c 'd 'e))
(i 1))
(values
(ccase (aref a (incf i))
(a 1)
(b 2)
(c 3)
(d 4))
i))
3 2)
;;; Repeated keys are allowed (all but the first are ignored)
(deftest ccase.26
(let ((x 'b))
(ccase x ((a b c) 10) (b 20)))
10)
(deftest ccase.27
(let ((x 'b))
(ccase x (b 20) ((a b c) 10)))
20)
(deftest ccase.28
(let ((x 'b))
(ccase x (b 20) (b 10) (d 0)))
20)
;;; There are implicit progns
(deftest ccase.29
(let ((x nil) (y 2))
(values
(ccase y
(1 (setq x 'a) 'w)
(2 (setq x 'b) 'y)
(3 (setq x 'c) 'z))
x))
y b)
;;; Need to add tests for continuability of the error,
;;; and resetting of the place.
ansi-tests/gclload2.lsp
View file @
4fc90271
...
...
@@ -16,6 +16,7 @@
(load "call-arguments-limit.lsp")
(load "case.lsp")
(load "catch.lsp")
(load "ccase.lsp")
(load "constantly.lsp")
(load "complement.lsp")
(load "cond.lsp")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment