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:
2.0 KB

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Sat Mar 28 07:37:21 1998 

4  ;;;; Contains: Testing of CL Features related to "CONS", part 10 

5  

6  (inpackage :cltest) 

7  

8  (compileandload "consaux.lsp") 

9  

10  (deftest last.1 

11  (last nil) 

12  nil) 

13  

14  (deftest last.2 

15  (last (copytree '(a b))) 

16  (b)) 

17  

18  (deftest last.3 

19  (last (copytree '(a b . c))) 

20  (b . c)) 

21  

22  (deftest last.4 

23  (last (copytree '(a b c d)) 0) 

24  nil) 

25  

26  (deftest last.5 

27  (last (copytree '(a b c d)) 1) 

28  (d)) 

29  

30  (deftest last.6 

31  (last (copytree '(a b c d)) 2) 

32  (c d)) 

33  

34  (deftest last.7 

35  (last (copytree '(a b c d)) 5) 

36  (a b c d)) 

37  

38  (deftest last.8 

39  (last (cons 'a 'b) 0) 

40  b) 

41  

42  (deftest last.9 

43  (last (cons 'a 'b) 1) 

44  (a . b)) 

45  

46  (deftest last.10 

47  (last (cons 'a 'b) 2) 

48  (a . b)) 

49  

50  (deftest last.11 

51  (let ((x '(a b c))) 

52  (eqt (last x (1+ mostpositivefixnum)) x)) 

53  t) 

54  

55  (deftest last.12 

56  (let ((x '(a b c . d))) 

57  (eqt (last x (1+ mostpositivefixnum)) x)) 

58  t) 

59  

60  (deftest last.13 

61  (let ((x '(a b c . d))) 

62  (eqt (last x mostpositivefixnum) x)) 

63  t) 

64  

65  (deftest last.14 

66  (let ((x '(a b c . d))) 

67  (eqt (last x (1 mostpositivefixnum)) x)) 

68  t) 

69  

70  (deftest last.order.1 

71  (let ((i 0) x y) 

72  (values 

73  (last (progn (setf x (incf i)) (list 'a 'b 'c 'd)) 

74  (setf y (incf i))) 

75  i x y)) 

76  (c d) 2 1 2) 

77  

78  (deftest last.order.2 

79  (let ((i 0)) 

80  (values (last (progn (incf i) (list 'a 'b 'c 'd))) i)) 

81  (d) 1) 

82  

83  (deftest last.error.1 

84  (signalserror (last (list 'a 'b 'c) 1) typeerror) 

85  t) 

86  

87  (deftest last.error.2 

88  (signalserror (last (list 'a 'b 'c) 'a) typeerror) 

89  t) 

90  

91  (deftest last.error.3 

92  (signalserror (last (list 'a 'b 'c) 10.0) typeerror) 

93  t) 

94  

95  (deftest last.error.4 

96  (signalserror (last (list 'a 'b 'c) 10.0) typeerror) 

97  t) 

98  

99  (deftest last.error.5 

100  (signalserror (last (list 'a 'b 'c) #\w) typeerror) 

101  t) 

102  

103  (deftest last.error.6 

104  (signalserror (last) programerror) 

105  t) 

106  

107  (deftest last.error.7 

108  (signalserror (last '(a b c) 2 nil) programerror) 

109  t) 

110  

111  (deftest last.error.8 

112  (signalserror (locally (last (list 'a 'b 'c) 'a) t) 

113  typeerror) 

114  t) 

115  

Note: See
TracBrowser
for help on using the repository browser.