Commit e71b2114 authored by pfdietz's avatar pfdietz

Added tests for MULTIPLE-VALUE-BIND/CALL/LIST.

parent cc55a33e
......@@ -44,6 +44,8 @@
(load "lambda-parameters-limit.lsp")
(load "let.lsp")
(load "macrolet.lsp")
(load "multiple-value-bind.lsp")
(load "multiple-value-call.lsp") ;; include multiple-value-list
(load "nil.lsp")
(load "not-and-null.lsp")
(load "notany.lsp")
......
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Fri Oct 18 23:16:23 2002
;;;; Contains: Tests for MULTIPLE-VALUE-BIND
(in-package :cl-test)
(deftest multiple-value-bind.1
(multiple-value-bind (x y z) (values 1 2 3)
(declare (type integer x))
(declare (type integer y))
(declare (type integer z))
(list z y x))
(3 2 1))
(deftest multiple-value-bind.2
(multiple-value-bind (x y z) (values 1 2 3)
(let ((x 4))
(list x y z)))
(4 2 3))
(deftest multiple-value-bind.3
(multiple-value-bind (x y z) (values 1 2 3 4 5 6)
(list x y z))
(1 2 3))
(deftest multiple-value-bind.4
(multiple-value-bind (x y z) (values 1 2)
(list x y z))
(1 2 nil))
(deftest multiple-value-bind.5
(multiple-value-bind () (values 1 2) (values 'a 'b 'c))
a b c)
(deftest multiple-value-bind.6
(multiple-value-bind (x y z) (values)
(list x y z))
(nil nil nil))
(deftest multiple-value-bind.7
(let ((z 0) x y)
(declare (special z))
(values
(flet ((%x () (symbol-value 'x))
(%y () (symbol-value 'y))
(%z () (symbol-value 'z)))
(multiple-value-bind (x y z) (values 1 2 3)
(declare (special x y))
(list (%x) (%y) (%z))))
x y z))
(1 2 0) nil nil 0)
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Fri Oct 18 23:35:07 2002
;;;; Contains: Tests of MULTIPLE-VALUE-CALL, MULTIPLE-VALUE-LIST
(in-package :cl-test)
(deftest multiple-value-call.1
(multiple-value-call #'+ (values 1 2) (values) 3 (values 4 5 6))
21)
(deftest multiple-value-call.2
(multiple-value-call 'list)
nil)
(deftest multiple-value-call.3
(multiple-value-call 'list (floor 13 4))
(3 1))
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deftest multiple-value-list.1
(multiple-value-list (values))
nil)
(deftest multiple-value-list.2
(multiple-value-list (values 'a))
(a))
(deftest multiple-value-list.3
(multiple-value-list (values 'a 'b))
(a b))
(deftest multiple-value-list.4
(not
(loop
for i from 0 below (min multiple-values-limit 100)
for x = (make-list i :initial-element 'a)
always (equal x (multiple-value-list (values-list x)))))
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