cons.lsp 1.05 KB
 pfdietz committed Apr 20, 2003 1 2 3 4 5 6 7 ``````;-*- Mode: Lisp -*- ;;;; Author: Paul Dietz ;;;; Created: Sat Apr 19 21:24:25 2003 ;;;; Contains: Tests for CONS (in-package :cl-test) `````` pfdietz committed Jun 20, 2004 8 9 ``````(compile-and-load "cons-aux.lsp") `````` pfdietz committed Jan 17, 2004 10 11 ``````;;; Various easy tests of cons `````` pfdietz committed Apr 20, 2003 12 13 14 15 16 17 18 19 ``````(deftest cons-of-symbols (cons 'a 'b) (a . b)) (deftest cons-with-nil (cons 'a nil) (a)) `````` pfdietz committed Jan 17, 2004 20 ``````;;; successive calls to cons produces results that are equal, but not eq `````` pfdietz committed Apr 20, 2003 21 22 ``````(deftest cons-eq-equal (let ((x (cons 'a 'b)) `````` sds committed Aug 12, 2009 23 `````` (y (cons 'a 'b))) `````` pfdietz committed Apr 20, 2003 24 `````` (and (not (eqt x y)) `````` sds committed Aug 12, 2009 25 `````` (equalt x y))) `````` pfdietz committed Apr 20, 2003 26 27 `````` t) `````` pfdietz committed Jan 17, 2004 28 ``````;;; list can be expressed as a bunch of conses (with nil) `````` pfdietz committed Apr 20, 2003 29 30 ``````(deftest cons-equal-list (equalt (cons 'a (cons 'b (cons 'c nil))) `````` sds committed Aug 12, 2009 31 `````` (list 'a 'b 'c)) `````` pfdietz committed Apr 20, 2003 32 33 34 35 36 37 38 `````` t) ;;; Order of evaluation of cons arguments (deftest cons.order.1 (let ((i 0)) (values (cons (incf i) (incf i)) i)) (1 . 2) 2) `````` pfdietz committed Jun 14, 2005 39 40 ``````(def-fold-test cons.fold.1 (cons 'a 'b)) `````` pfdietz committed Jan 17, 2004 41 42 ``````;;; Error tests `````` pfdietz committed Apr 20, 2003 43 ``````(deftest cons.error.1 `````` pfdietz committed Jan 17, 2004 44 45 `````` (signals-error (cons) program-error) t) `````` pfdietz committed Apr 20, 2003 46 47 `````` (deftest cons.error.2 `````` pfdietz committed Jan 17, 2004 48 49 `````` (signals-error (cons 'a) program-error) t) `````` pfdietz committed Apr 20, 2003 50 51 `````` (deftest cons.error.3 `````` pfdietz committed Jan 17, 2004 52 53 `````` (signals-error (cons 'a 'b 'c) program-error) t)``````