source: trunk/source/tests/ansi-tests/nthcdr.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 1.3 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 19 22:48:36 2003
4;;;; Contains: Tests of NTHCDR
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10;;; Error tests
11
12(deftest nthcdr.error.1
13  (check-type-error #'(lambda (x) (nthcdr x (copy-list '(a b c d)))) (typef 'unsigned-byte))
14  nil)
15
16(deftest nthcdr.error.6
17  (signals-error (nthcdr -10 (copy-tree '(a b c d))) type-error)
18  t)
19
20(deftest nthcdr.error.7
21  (signals-error (nthcdr) program-error)
22  t)
23
24(deftest nthcdr.error.8
25  (signals-error (nthcdr 0) program-error)
26  t)
27
28(deftest nthcdr.error.9
29  (signals-error (nthcdr 0 nil nil) program-error)
30  t)
31
32(deftest nthcdr.error.10
33  (signals-error (nthcdr 3 (cons 'a 'b)) type-error)
34  t)
35
36(deftest nthcdr.error.11
37  (signals-error (locally (nthcdr 'a (copy-tree '(a b c d))) t) type-error)
38  t)
39
40;;; Non-error tests
41
42(deftest nthcdr.1
43  (nthcdr 0 (copy-tree '(a b c d . e)))
44  (a b c d . e))
45
46(deftest nthcdr.2
47  (nthcdr 1 (copy-tree '(a b c d)))
48  (b c d))
49
50(deftest nthcdr.3
51  (nthcdr 10 nil)
52  nil)
53
54(deftest nthcdr.4
55  (nthcdr 4 (list 'a 'b 'c))
56  nil)
57
58(deftest nthcdr.5
59  (nthcdr 1 (cons 'a 'b))
60  b)
61
62(deftest nthcdr.order.1
63  (let ((i 0) x y)
64    (values
65     (nthcdr (setf x (incf i))
66             (progn (setf y (incf i)) '(a b c d)))
67     i x y))
68  (b c d) 2 1 2)
69
Note: See TracBrowser for help on using the repository browser.