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.2 KB

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Sat Apr 19 22:33:23 2003 

4  ;;;; Contains: Tests of NTH 

5  

6  (inpackage :cltest) 

7  

8  (compileandload "consaux.lsp") 

9  

10  (deftest nth.1 

11  (nth1body (loop for i from 1 to 2000 collect (* 4 i))) 

12  0) 

13  

14  (deftest nth.2 

15  (let ((x (loop for i from 1 to 2000 collect i))) 

16  (loop 

17  for i from 0 to 1999 do 

18  (setf (nth i x) ( 1999 i))) 

19  (equalt x (loop for i from 1999 downto 0 collect i))) 

20  t) 

21  

22  ;;; Test side effects, evaluation order in assignment to NTH 

23  (deftest nth.order.1 

24  (let ((i 0) 

25  (x (list 'a 'b 'c 'd)) 

26  y z) 

27  (and 

28  (eqlt (setf (nth (setf y (incf i)) x) (progn (setf z (incf i)) 'z)) 

29  'z) 

30  (eqlt y 1) 

31  (eqlt z 2) 

32  x)) 

33  (a z c d)) 

34  

35  (deftest nth.order.2 

36  (let ((i 0) x y (z '(a b c d e))) 

37  (values 

38  (nth (progn (setf x (incf i)) 1) 

39  (progn (setf y (incf i)) z)) 

40  i x y)) 

41  b 2 1 2) 

42  

43  (deftest nth.error.1 

44  (signalserror (nth) programerror) 

45  t) 

46  

47  (deftest nth.error.2 

48  (signalserror (nth 0) programerror) 

49  t) 

50  

51  (deftest nth.error.3 

52  (signalserror (nth 1 '(a b c) nil) programerror) 

53  t) 

54  

55  (deftest nth.error.4 

56  (signalserror (nth 0 '(a b c) nil) programerror) 

57  t) 

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